Support » Plugin: Jetpack by » Jetpack for Super Admins only

  • Resolved mannski


    I manage a multisite network and only want super admins to have access to Jetpack settings. I want to restrict individual site administrators from accessing Jetpack. Here’s what I’m trying now:

    function remove_jetpack_menu() {
       if (!current_user_can('manage_network')) {
          remove_menu_page( 'jetpack' );
    add_action('admin_menu', 'remove_jetpack_menu');

    I’m able to remove many other admin menu pages using this same function and hook, but I can’t remove Jetpack.

    I’ve also tried using the longer menu page slug. That didn’t work either:

    remove_menu_page( 'admin.php?page=jetpack' );

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Jeremy Herve


    Something like this should do the trick:

    function jp_rm_menu() {
    	if( class_exists( 'Jetpack' ) && !current_user_can( 'manage_network' ) ) {
    		// This removes the page from the menu in the dashboard
    		remove_menu_page( 'jetpack' );
    add_action( 'admin_init', 'jp_rm_menu' );

    Thanks, Jeremy. I’m not sure why, but your solution is not working for me either. In fact, it’s making the entire admin area of the site go white, like it’s causing a PHP error.

    Plugin Contributor Jeremy Herve


    I’ve tested it and it worked fine in my tests. Could you make sure you’ve pasted it properly?

    You’ll want to paste it into a functionality plugin:

    I don’t use a functionality plugin, but I looked at the code closely to make sure it all looked correct. I tried adding it to my site in two different ways: first, to a plugin I created to manage user permissions; when that didn’t work, I removed it and pasted it in my theme’s functions.php file. Same result.

    I was able to get this working by putting the “if” statement within another larger function whose purpose was to remove several pages from the admin menu.

    Looks like the important thing is to use admin_init hook. I had been using admin_menu to remove items from the admin menu, but that doesn’t seem to work on Jetpack.

    I can confirm that removing a menu doesn’t work like
    remove_menu_page( 'jetpack' );
    Seems like the issue is not Jetpack. I have tablepress on my menu but I can’t remove it either.
    I suppose the issue is when hiding a menu under admin.php

    I wonder if this is a known issue.

    Plugin Contributor Jeremy Herve


    remove_menu_page( 'jetpack' ); works, but you’ll need to hook it to admin_init to make sure it works, as @mannski pointed above.

    Thanks Jeremy, I did not see that the difference was on the hook.

    Solution from Jeremy Herve works but need some changes. Replace admin_init to admin_menu and set 999 priority.
    add_action( ‘admin_menu’, ‘jp_rm_menu’, 999 );

    Hey, Kolya’s solution did remove the Jetpack menu but also for super amin.

    Any ideas?


    Plugin Contributor Jeremy Herve


    @myuption Check the code I posted here to find out how to remove the menu only for editors, authors, and subscribers.

    Thanks Jeremy, that helped! 🙂



    Thanks Jeremy!

    I had the same goal as op (retain menu item only for Super Admin) and have slightly adjusted the code supplied here.

    I created a must-use functions file and have added:

    function custom_network_delete_jetpack_menu() {
            if ( ! current_user_can( 'manage_network' ) ) {
                    remove_menu_page( 'jetpack' );
    add_action ( 'admin_menu', 'custom_network_delete_jetpack_menu', 999 );

    Worked a treat, and no media upload issues! Awesome sauce 🙂

    Cheers, Max

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Jetpack for Super Admins only’ is closed to new replies.