I installed jetpack to my wordpress blog site. How can I hide jetpack to contributors, and show it only to administrators?


closed as off-topic by Mark Kaplun, birgire, Pieter Goosen, gmazzap, Johannes Pille Sep 28 '14 at 12:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, birgire, Pieter Goosen, gmazzap, Johannes Pille
If this question can be reworded to fit the rules in the help center, please edit the question.


This code will do the trick. Create a file, jetpack-hide.php (or another name of your choosing) and upload it to wp-content/mu-plugins (create that directory if it doesn't exist).

add_action( 'jetpack_admin_menu', 'hide_jetpack_from_others' );
function hide_jetpack_from_others() {
    if ( ! current_user_can( 'administrator' ) ) {
        remove_menu_page( 'jetpack' );

To re-enable JetPack for all users, simply delete that file, or rename it. I usually append .OFF to a mu-plugin that I want to disable, e.g., jetpack-hide.php.OFF.

  • +1 for the Jetpack specific hook. Using current_user_can with a role is a bit controversial... better use a capability. Redirecting URL access attempts is a nice touch too ;) – brasofilo Jan 25 '13 at 16:19
  • Thanks, @brasofilo. Wish I could take credit, it was adapted from this thread. – akTed Jan 25 '13 at 18:10

You can use a custom plugin, that hide this item in the menu, if the current user have the role "contributor".

The jetpack plugin allow the menu item for all roles, there have the capability read, on a default install have this all roles. add_menu_page( 'Jetpack', $title, 'read', 'jetpack', array( $this, 'admin_page' ), 'div' )

A example for a custom plugin, there remove this menu item, if the user have not the role administrator.

 * Plugin Name: Remove Jetpack Menu Item for roles smaller Admin
add_action( 'admin_menu', 'fb_remove_menu_entries' );
function fb_remove_menu_entries () {
    // with WP 3.1 and higher
    if ( ! current_user_can( 'administrator' ) )
        remove_menu_page( 'jetpack' );


More background about this topic do you find as example in this post.

Alternative is a plugin, that give you a options for this, like Adminimize. This plugin allow to hide different areas, objekt for different roles. A little bid easier to go to your goal, but more options as custom plugin.

  • Um, your code is nearly identical to what I posted, with the exception that your function will run even if JetPack is not currently installed. – akTed Jan 25 '13 at 18:19
  • Your code is one point better, you use a custom hook from the plugin. If the plugin Jetpack is not active, then is not a error. The core funtion check it and is not a problem. – bueltge Jan 27 '13 at 19:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.