Skip to content

Instantly share code, notes, and snippets.

@jeherve

jeherve/jp-rm-jpmenu.php

Last active Nov 27, 2016
Embed
What would you like to do?
[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
You can’t perform that action at this time.