Search code examples
wordpressmenumenuitemsubmenu

Remove sub menu items


I want to remove a few sub menu items from the admin menu in WordPress. I have found the following which can remove certain sub menu items...

add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page = remove_submenu_page( 'themes.php', 'widgets.php' );
}

...but what if it is not a standard php such as "themes.php?page=custom-header" that I would like removed.


Solution

  • Add code in your function.php

    Remove "themes.php?page=custom-header" option using this code.
    
    
    function remove_twentyeleven_options() {
        remove_custom_image_header();
    }
    add_action( 'after_setup_theme','remove_twentyeleven_options', 100 );