Skip to content

Instantly share code, notes, and snippets.

@dallasread
Created November 12, 2014 19:36
Show Gist options
  • Save dallasread/92e94b7d59f1c5b45bf7 to your computer and use it in GitHub Desktop.
Save dallasread/92e94b7d59f1c5b45bf7 to your computer and use it in GitHub Desktop.
If not admin, hide admin bar and WP Admin area
public static function remove_admin_bar() {
if (!current_user_can("administrator")) {
show_admin_bar(false);
}
}
public static function redirect_if_not_admin() {
if (!current_user_can("administrator")) {
wp_redirect( site_url() );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment