Skip to content

Instantly share code, notes, and snippets.

@matheusgimenez
Created December 21, 2014 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusgimenez/228efc824449018ef021 to your computer and use it in GitHub Desktop.
Save matheusgimenez/228efc824449018ef021 to your computer and use it in GitHub Desktop.
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