Jetpack from WordPress.com

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.

9 thoughts on “Quick Tip: Hide Jetpack from non-admins

Leave a Reply

Mojowill Avatar

Who the Hell am I?

I'm Will, a full time web developer, geek and musician. I develop using PHP and MySQL and spend most of my time working with WordPress or CakePHP. When I'm not buried in code I'm gaming, cooking or writing and recording music in my studio. I like sci-fi, pancakes and coffee and am totally prepared for the zombie apocalypse...

Stalk me on these other sites...

Why not be super creepy and check me out on all these other sites, I think they call it social media?