Created
May 15, 2015 12:55
-
-
Save miziomon/d476c3d864d09a828712 to your computer and use it in GitHub Desktop.
WordPress user admin redirect
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
/** | |
* | |
* redirect to homepage if has non "edit_posts" capabilities | |
*/ | |
add_filter("admin_init", function () { | |
if (!current_user_can('edit_posts')) { | |
wp_redirect(WP_HOME); | |
exit; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment