Created
December 21, 2014 22:33
-
-
Save matheusgimenez/228efc824449018ef021 to your computer and use it in GitHub Desktop.
This file contains 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
function remove_admin_bar() { | |
if( ! current_user_can('edit_posts') ) | |
add_filter('show_admin_bar', '__return_false'); | |
} | |
add_action( 'after_setup_theme', 'remove_admin_bar' ); | |
function remove_admin(){ | |
if ( ! current_user_can( 'edit_posts' ) ){ | |
wp_redirect( site_url() ); | |
exit; | |
} | |
} | |
add_action( 'admin_init', 'remove_admin' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment