Remove WP About Menu from toolbar?

Is there an easy/convenient way to remove that most annoying WP logo with the About WordPress, WordPress.org etc links under it that now appears on the toolbar/adminbar?

Thanks much.

  • Timothy
    • Chief Pigeon

    Hey edhitors.

    Yeah I find those links annoying as well.

    There are a few options. If open the following file you’ll find where the code is used:

    /wp-includes/class-wp-admin-bar.php

    And around line 456:

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

    So we could do this:

    add_action( 'add_admin_bar_menus', 'tkb_remove_wp_admin_bar_links');
    function tkb_remove_wp_admin_bar_links(){
    remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu' );
    }

    Now the WP links part is all gone! :slight_smile:

    But….. But……… If you wanted to edit those links to customise yourself, you can see the code:

    /wp-includes/admin-bar.php

    You’ll see it all near the top, here is a short snippet:

    if ( is_user_logged_in() ) {
    // Add "About WordPress" link
    $wp_admin_bar->add_menu( array(
    'parent' => 'wp-logo',
    'id' => 'about',
    'title' => __('About WordPress'),
    'href' => admin_url('about.php'),
    ) );
    }

    You will note much of the same on there.

    The logo is part of a sprite which can be found here:

    /wp-includes/images/admin-bar-sprite.png

    And now the final option, which is the easiest, but its yet another plugin……….. Just pop the file into your mu-plugins folder and it will work globally.

  • edihtors
    • Site Builder, Child of Zeus

    I was hoping I was missing a setting somewhere or something, but appreciate the pointers to the code for this.

    I think it’s kind of dumb WordPress added all of this muck into the global toolbar without an option to remove it. It was really confusing the userbase of our site.

  • Timothy
    • Chief Pigeon

    Hey there.

    My preferred method is always to edit those files direct, it means you limit the bloat which can happen in WP installs when a plugin is used for everything. The issue here is, that every time you upgrade then those changes need to be made again, and again. (A Plugin should just continue to work without further work needed on future upgrades)

    I made a post on the following link some months ago which may help elaborate what I mean:

    https://premium.wpmudev.org/forums/topic/workflow-for-setting-up-an-online-service-like-edublogs#post-86111

    In this instance with the plugin file I provided, is just one file, no data. But its essentially removing an action that was already added previously by the core. So for me personally, I would rather hit the root of the problem and either alter the original action to my liking or prevent it from happening thus not requiring more code to cancel out the original code.

    In reality this file is only around 4kb so it most likely would never be noticeable, ever. I’m most likely just being way over the top on this one small file and you need not worry. Just use the plugin :slight_smile:

    Glad it works for you :slight_smile:

  • Strategerizer
    • Site Builder, Child of Zeus

    Timothy, your plugin works like a charm, thanks for that. I also am not a big fan of adding plugins for each little thing but it ends up being a more practical way to solve the issue than editing WP files and have them be written over on the next WP update… or do you think editing /wp-includes/class-wp-admin-bar.php would be relatively safe from future updates?

    Thanks again for the contribution!

  • Timothy
    • Chief Pigeon

    Hi Strategerizer

    Your welcome :slight_smile:

    or do you think editing /wp-includes/class-wp-admin-bar.php would be relatively safe from future updates?

    unfortunately not, any file in the core of WP could be altered at anytime. Plus when coming to upgrade, to know for sure you would have to run a differential program and remember which files not to upload.

    All that gets much more complicated than a plugin. :slight_frown:

    I have a checklist of preferred changes I make on every update, because most are only small I always manually do them. But I suppose there is nothing stopping people from running their own SVN or similar.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.