How can I remove the WP menu from the admin bar?

I never use the WP menu (the logo and its child items) except when I click it accidentally. And it is wasting my time when I navigate per keyboard. Plus, the support page is not our site.

How can I remove it?

Related posts

Leave a Reply

3 comments

  1. This menu is added in WP_Admin_Bar::add_menus() with an action:

    add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
    

    To remove it take the same action – just one step later. The following code works as a mu plugin or as a regular plugin:

    <?php # -*- coding: utf-8 -*-
    /**
     * Plugin Name: Remove WP Menu From Tool Bar
     */
    if ( ! function_exists( 't5_remove_wp_menu' ) )
    {
        // The action is added with a priority of 10, we take one step later.
        add_action( 'init', 't5_remove_wp_menu', 11 );
    
        /**
         * Remove the WP menu action.
         */
        function t5_remove_wp_menu()
        {
            is_admin_bar_showing() &&
                remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
        }
    }
    

    It has a GitHub address too.

    After the installation the sites menu is the first one.

    See also this great answer for other menus and more details about the inner workings of the admin bar/tool bar.

    Update

    The old code doesn’t work anymore, this one does:

    add_action( 'add_admin_bar_menus', function() {
        remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu' );
    });
    
  2. also possible, only as hint:

    add_action( 'admin_bar_menu',    'fb_admin_bar_menu', 25 );
    
    /**
     * Removes the "W" logo from the admin menu
     *
     * @access public
     */
    function fb_admin_bar_menu( $admin_bar ) {
    
        $admin_bar->remove_node( 'wp-logo' );
    }
    
  3. @PieterGoosen & @kaiser

    https://wordpress.org/plugins/osd-remove-all-wp-creds/

    That is the link to the plugin. It removes quite a few WP plugs like:

    Title Bar in Admin Section
    Favicon in Admin Section
    Favicon on Login Page
    Tagline
    Admin Menu Bar
    Various widgets are removed
    Various Meta boxes
    Welcome Panel
    Admin Footer
    Login Screen Logo
    Login Screen Title
    

    The plugin code is commented pretty well, so it is easy to deduce what I have done and repeat it on your own in your functions.php file or whatever you choose.

    Here are a few blocks of code from the plugin to answer the original question plus a bonus:

    //This adds an action to the admin bar menu that removes the WP Logo simple and sweet
    function osd_remove_wp_from_theme($wp_admin_bar) {
        $wp_admin_bar->remove_node('wp-logo');
    }
    add_action('admin_bar_menu', 'osd_remove_wp_from_theme', 999);
    

    bonus:

    //filter to remove wp from title(the text displayed in the browser bar) in admin section
    function osd_remove_wp_from_admin_title() {
        return get_bloginfo('name') . " > Administration";
    }
    add_filter('admin_title', 'osd_remove_wp_from_admin_title');