-
-
Save Shoora/d36dc7a49bfbe308e3106b8525a79c2a to your computer and use it in GitHub Desktop.
WordPress user admin redirect
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
/** | |
* | |
* 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