4

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?

7

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

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' );
}
4
  • +1 for OOP alternative. But don’t we waste some microseconds when we let WordPress create the menu first and delete it later? :)
    – fuxia
    Jun 18 '12 at 18:18
  • 1
    right; but on your solution is also an lost of seconds ;) the init was always fired, also if you not logged in and the admin bar is inactive; maybe we can check for is admin bar active and then we remove the menu item. maybe via if ( ! is_admin_bar_showing() ) return;
    – bueltge
    Jun 19 '12 at 6:33
  • Good hint, I can at least save the _wp_filter_build_unique_id() look-up.
    – fuxia
    Jun 19 '12 at 7:29
  • yup, fine and now it is faster.
    – bueltge
    Jun 19 '12 at 8:57
0

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

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.