Created
          June 1, 2015 01:20 
        
      - 
      
 - 
        
Save alenabdula/cb1d06743e42d8d77173 to your computer and use it in GitHub Desktop.  
    Redirect Non-Users
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| add_action( 'init', 'block_access_to_wp_dashboard_init' ); | |
| /** | |
| * | |
| */ | |
| function block_access_to_wp_dashboard_init() { | |
| if ( is_admin() && ! current_user_can( 'edit_users' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { | |
| wp_redirect( home_url() ); | |
| exit; | |
| } | |
| } | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment