Skip to content

Instantly share code, notes, and snippets.

@emilstahl
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emilstahl/11306857 to your computer and use it in GitHub Desktop.
Save emilstahl/11306857 to your computer and use it in GitHub Desktop.
JetPack Non-Admin Removal
add_action( 'admin_init', 'jetpack_nonadmin_removal_init');
function jetpack_nonadmin_removal_init() {
if( !is_admin || !current_user_can( 'manage_options' ) ) {
if(false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=jetpack')){wp_redirect('/wp-admin/', 302);}
if(false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=omnisearch')){wp_redirect('/wp-admin/', 302);}
remove_menu_page( 'jetpack' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment