Remove All in One Pack from the admin bar

Hello I want to remove All in One Pack from the admin bar.

I can remove anything else but it. I have already removed other things like update from the admin bar using this method

Get the menu's id by this code:

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

and then remove the menu or the submenu by this code:

function aldous_remove_items_from_admin_bar( $wp_admin_bar ) {
    $wp_admin_bar->remove_node('updates');//remove the update from wordpress core.
    $wp_admin_bar->remove_node('all-in-one-seo-pack');// this code not work and I want it to work to remove the menu.
}
add_action( 'admin_bar_menu', 'aldous_remove_items_from_admin_bar', 999 );

In this image you will find the id by using the first code: enter image description here

Answers 1

Related Questions