marstheme

Untitled

May 9th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. if( ! function_exists( 'videotube_prevent_access_backend' )  ){
  2.    
  3.     /*
  4.      * Redirect members to custom url while accessing backend.
  5.      */
  6.    
  7.     function videotube_prevent_access_backend() {
  8.        
  9.         // The custom url goes here.
  10.         $custom_url = '';
  11.        
  12.         if( is_user_logged_in() && ! current_user_can( 'administrator' ) && is_admin() && ! empty( $custom_url ) ){
  13.             wp_redirect( $custom_url );
  14.             exit;
  15.         }
  16.     }
  17.    
  18.     add_action( 'admin_init' , 'videotube_prevent_access_backend' );
  19. }
Advertisement
Add Comment
Please, Sign In to add comment