Hide menu item in wp-admin and admin bar
Those two functions hide any menu from the wp-admin panel and also from your admin bar. In this example we removed the themes menu so your client’s don’t change the theme. However it is still accessable by wp-admin/themes.php
/** * Snippet Name: Hide menu item in wp-admin and admin bar * Snippet URL: https://wpcustoms.net/snippets/hide-menu-item-in-wp-admin-and-admin-bar/ */ // this function hides the 'theme' menu in wp-admin function wpc_hide_adminpanel_link() { global $submenu, $userdata; get_currentuserinfo(); if ($userdata->ID != 1) { unset($submenu['themes.php'][5]); unset($submenu['themes.php'][15]); } } add_action('admin_init', 'wpc_hide_adminpanel_link'); // this function takes care of the frontend admin bar and removes the 'theme' menu function wpc_hide_adminbar_link() { global $wp_admin_bar; $wp_admin_bar->remove_menu('themes'); } add_action( 'wp_before_admin_bar_render', 'wpc_hide_adminbar_link' );