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' );

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

1 Answer 1


You are almost there! If you check out where the plugin developer is adding this action, you'll see they are setting a priority of 1000. While the priority of your function is being called at 999.


Update your priority to be greater than 1000:

add_action( 'admin_bar_menu', 'aldous_remove_items_from_admin_bar', 1200 );

Overriding function calls with plugins is a bit tricky, because you don't know what sort of priority they set on their calls.

Hope that helps!!

  • Thank you you saved my time. I used the css to do the job but I removed them to test your solution and it's worked. So I will use yours :) Commented Aug 1, 2019 at 17:15

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.