Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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


share|improve this question

2 Answers 2

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.

share|improve this answer
+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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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