WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following script within my functions.php file to avoid certain users from modifying things they shouldn't and would like to remove one more item, the Appearances > Themes submenu.

function remove_menus () {
global $menu;
    $restricted = array(__('Dashboard'), __('Posts'), __('Pages'), __('Comments'), __('Plugins'), __('Users'), __('Tools'), __('Links'), __('Settings'));
    end ($menu);
    while (prev($menu)){
        $value = explode(' ',$menu[key($menu)][0]);
        if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
add_action('admin_menu', 'remove_menus');

How would I be able to achieve this?

share|improve this question
up vote 0 down vote accepted

Use the API functions remove_menu_page and remove_submenu_page to remove menu items rather than manipulating global variables.

This will remove the themes page under appearance:

function wpa_remove_themes_submenu() {
    remove_submenu_page( 'themes.php', 'themes.php' );
add_action( 'admin_menu', 'wpa_remove_themes_submenu', 999 );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.