Created
November 12, 2014 19:36
-
-
Save dallasread/92e94b7d59f1c5b45bf7 to your computer and use it in GitHub Desktop.
If not admin, hide admin bar and WP Admin area
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
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