How to remove the Jetpack admin menu from subscribers

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 ๐Ÿ˜‰





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.