Hide the Jetpack Menu From Non-Administrators
Removes the Jetpack menu (and its dashboard widget) for authors, editors and other roles that cannot manage options, so they only see what they need.
Opens WPIDE on
Code
add_action( 'admin_menu', function () {
if ( ! current_user_can( 'manage_options' ) ) {
remove_menu_page( 'jetpack' );
}
}, 999 );
add_action( 'wp_dashboard_setup', function () {
if ( ! current_user_can( 'manage_options' ) ) {
remove_meta_box( 'jetpack_summary_widget', 'dashboard', 'normal' );
}
}, 999 );
Notes
Administrators still see everything.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.