Archive Old post. Originally published 7 December 2012 on the WordPress version of this site. Preserved here for the search engines and the curious. Old me had opinions.
Developer 2 min read

Quick Tip: Hide Jetpack from non-admins

I recently wrote a review and introduction to Jetpack with WordPress. I today discovered that non-admins (editors, even subscribers!) could see the Jetpack menu in the WordPress Dashboard. This for me is a bit of a no no and actually cannot believe it’s there! However it is fairly simple to remove it:

add_action( 'admin_menu', 'remove_menus' );

function remove_menus(){
if( !current_user_can( 'add_users' ) ){
remove_menu_page( 'jetpack' );
}
}

Stick that in your functions.php file and you’ll see Jetpack disappear for the mere mortals!

UPDATE 14/12/2012: It seems that the original hook indicated in the Codex was incorrect and should be “admin_menu” not “admin_init”. See here. I have updated the example above.


Filed under Developer. No comments, on purpose.