I am trying to remove menu from the admin panel

my code works as it removes some pages but i can't remove the following. admin.php?page=ot-theme-options admin.php?page=ot-settings admin.php?page=yith_woocompare_panel

add_action('admin_menu', 'remove_admin_menu_links');
function remove_admin_menu_links(){
    $user = wp_get_current_user();
    if( $user && isset($user->user_email) && '[email protected]' == $user->user_email ) {
        remove_menu_page( 'themes.php' );  
        remove_submenu_page( 'themes.php', 'widgets.php' ); 
        remove_menu_page( 'wpcf7' ); 
        remove_menu_page( 'ot-theme-options' ); // Doesn't work
        remove_menu_page( 'ot-settings' ); // Doesn't work 

      //echo '<pre>' . print_r( $GLOBALS[ 'menu' ], TRUE) . '</pre>';


1 Answer 1

remove_submenu_page( 'themes.php', 'ot-theme-options' );
remove_submenu_page( 'themes.php', 'ot-settings' );
  • Could you explain a little bit more why this would solve OP's question?
    – cjbj
    Commented Aug 29, 2017 at 15:31
  • codex.Maybe he used Theme Options framework.url: ../themes.php?page=ot-theme-options/ So in code : themes.php targets the Appearances menu and ot-theme-options is the menu_slug used in his theme
    – Rei
    Commented Aug 29, 2017 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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