Create a gist now

Instantly share code, notes, and snippets.

WordPress user admin redirect
/**
*
* 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