Hide submenu wordpress?

How to hide customize menu and another submenu on wordpress?

I already hide some submenu on wordpress like

Read More
function hiden() {
    remove_submenu_page( 'themes.php', 'widgets.php' );//widget
    remove_submenu_page( 'themes.php', 'theme-editor.php' ); //editor
    remove_submenu_page( 'themes.php', 'theme_options' );} //theme-option
add_action('admin_head', 'hiden');

but if I want to remove customize menu remove_submenu_page( 'themes.php', 'customize.php' )… but It can’t… Anybody can help me, whats wrong ???
Thank you

Related posts

Leave a Reply

2 comments

  1. If you deal with wp menus you shoudl use admin_menu filter.

    add_filter('admin_menu', 'admin_menu_filter',500);
    function admin_menu_filter(){
        remove_submenu_page( 'themes.php', 'widgets.php' );//widget
        remove_submenu_page( 'themes.php', 'theme-editor.php'); //editor
        remove_submenu_page( 'themes.php', 'theme_options' ); //theme-option
    }
    add_action('admin_print_styles-themes.php', 'hide_customize');
    function hide_customize(){
        echo '<style>#customize-current-theme-link{display:none;}</style>';
    }
    

    you can place it to your plugin or functions.php in your theme.

  2. The correct page url of customize.php is customize.php?return=%2Fwordpress%2Fwp-admin%2Fnav-menus.php

    So to remove the submenu use:

    remove_submenu_page( 'themes.php', 'customize.php?return=%2Fwordpress%2Fwp-admin%2Fnav-menus.php' ); // hide the customize submenu