mariovalney

bloqueio-do-andersu.php

Feb 18th, 2020
256
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Plugin Name: Bloqueio do Andersu
  4.  * Description: Bloqueia certas páginas para usuários logados.
  5.  * Version: 1.0.0
  6.  */
  7.  
  8. add_action( 'init', 'bda_redirect_logged' );
  9. function bda_redirect_logged() {
  10.     if ( ! is_user_logged_in() ) {
  11.         return;
  12.     }
  13.    
  14.     $blocked = [ 'minha-page', 'outra-pagina' ];
  15.  
  16.     foreach ( $blocked as $page ) {
  17.         if ( ! is_page( $page ) ) {
  18.             continue;
  19.         }
  20.            
  21.         wp_redirect( home_url(), 302 );
  22.     }
  23. }
RAW Paste Data