Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active November 27, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeherve/4531266 to your computer and use it in GitHub Desktop.
Save jeherve/4531266 to your computer and use it in GitHub Desktop.
[Jetpack] How to hide the Jetpack menu to all non-admins https://github.com/jeherve/jetpack-addons/archive/jetpack-admins.zip
<?php
/*
* Plugin Name: Jetpack Only for Admins
* Plugin URI: http://wordpress.org/extend/plugins/
* Description: Hides the Jetpack menu for all non-admins
* Author: Jeremy Herve
* Version: 1.1
* Author URI: http://jeremyherve.com
* License: GPL2+
* Text Domain: jetpack
*/
function jp_rm_menu() {
if ( class_exists( 'Jetpack' ) && ! current_user_can( 'manage_options' ) && is_admin() && is_user_logged_in() ) {
remove_menu_page( 'jetpack' );
}
}
add_action( 'admin_menu', 'jp_rm_menu', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment