How to hide "BeTheme Demo Data" in Appearance Menu ?

Hi !

I'd like to hide (or disable if possible) the submenu "BeTheme Demo Data" for all users (except super admin)

Here's my function for hiding admin menus (functions.php)

if(!current_user_can('update_core')) {
    add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
    function adjust_the_wp_menu() {
        // LEVEL 1
        remove_menu_page( 'edit-comments.php' );                  
        remove_menu_page( 'tools.php' );                                
        remove_menu_page( 'options-general.php' );   
            
        // APPEARENCE -> WP SUBMENUS
        remove_submenu_page( 'themes.php', 'themes.php' );            
        remove_submenu_page( 'themes.php', 'widgets.php' );        
        global $submenu;
        unset($submenu['themes.php'][6]);

        // APPEARENCE -> BeTheme Demo Data SUBMENU
        ------------------ HOW TO ? -----------------------                          
    }
}

Thanks in advance for your help !



Comments

  • Hey,

    unfortunately we can't help you because we do not offer files modifications. All similar modifications must be done by website developer only.

    Thanks for understanding!
  • Ok, no problem, I managed to hide this submenu !

    I just added this line in my adjust_the_wp_menu function :
    unset($submenu['themes.php'][11]);

    To debug and find the right array, i used this function :

    if (!function_exists('debug_admin_menus')):
    function debug_admin_menus() {
    if ( !is_admin())
            return;
        global $submenu, $menu, $pagenow;
        if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN
            if( $pagenow == 'index.php' ) {  // PRINTS ON DASHBOARD
                echo '<pre>'; print_r( $menu ); echo '</pre>'; // TOP LEVEL MENUS
                echo '<pre>'; print_r( $submenu ); echo '</pre>'; // SUBMENUS
            }
        }
    }
    add_action( 'admin_notices', 'debug_admin_menus' );
    endif;


Sign In or Register to comment.