How to remove the Jetpack admin menu from subscribers

- by

JetPackThe Jetpack admin menu is visible to everybody, including subscribers. This may not be what you want. You may even want to hide it from other admins, perhaps once you’ve given a site over o a client and you don’t want him to switch off vital functionality by accident.

Here’s how you can hide the Jetpack admin menu in your WordPress back end.

Hide Jetpack from Non-Admins (including Subscribers)

If you would like your admin users to see Jetpack and hide it from everyone else, add this to your theme’s function.php file:

function pinkstone_remove_jetpack() {
	if( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
		remove_menu_page( 'jetpack' );
	}
}
add_action( 'admin_init', 'pinkstone_remove_jetpack' );

Here we test “is Jetpack actually running”, and if it is, “is this user an administrator”. If all signs point to yes then we’ll remove the menu page. You can replace “pinkstone” with another prefix of course.

Feel free to change the user capabilities to something else if you’d like to make Jetpack visible to authors or editors. You can read more about those options here:
https://codex.wordpress.org/Roles_and_Capabilities

You can also achieve this functionality by installing a super small plugin courtesy of Jeremy Herve, lead author of Jetpack:
http://wordpress.org/support/topic/how-do-i-disable-jetpack-from-subscribers

Hide Jetpack from everybody

Here we remove the check for capabilities altogether, hiding Jetpack from all users:

function pinkstone_remove_jetpack() {
	if( class_exists( 'Jetpack' ) ) {
		remove_menu_page( 'jetpack' );
	}
}
add_action( 'admin_init', 'pinkstone_remove_jetpack' );

I have included this functionality in my Zen Dash plugin with the latest version 1.4, where you can now hide Jetpack from admins and other users at the flick of a switch (and bring it back just as easily):

Have fun, and happy hacking 😉



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

6 thoughts on “How to remove the Jetpack admin menu from subscribers”

  1. For anyone who finds this post -> remove stuff from admin bar:

    function remove_admin_bar_links() {
    if (!current_user_can('edit_posts')) {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('dashboard'); // Remove the dashboard link
    $wp_admin_bar->remove_menu('site-name'); // Remove the site name link
    $wp_admin_bar->remove_menu('wp-logo'); // Remove the WordPress logo
    $wp_admin_bar->remove_menu('about'); // Remove the about WordPress link
    $wp_admin_bar->remove_menu('wporg'); // Remove the WordPress.org link
    $wp_admin_bar->remove_menu('documentation'); // Remove the WordPress documentation link
    $wp_admin_bar->remove_menu('support-forums'); // Remove the support forums link
    $wp_admin_bar->remove_menu('feedback'); // Remove the feedback link
    $wp_admin_bar->remove_menu('updates'); // Remove the updates link
    $wp_admin_bar->remove_menu('comments'); // Remove the comments link
    $wp_admin_bar->remove_menu('new-content'); // Remove the content link
    $wp_admin_bar->remove_menu('my-account'); // Remove the user details tab
    }
    }
    add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.