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) && 'name@domain.com' == $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>';

remove_submenu_page( 'themes.php', 'ot-theme-options' );
remove_submenu_page( 'themes.php', 'ot-settings' );
| improve this answer | |
  • Could you explain a little bit more why this would solve OP's question? – cjbj Aug 29 '17 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 Aug 29 '17 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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