Hi

I have been trying to remove certain items from the admin bar which appear at the top of all WordPress pages. I've managed to remove the 'visit' menu from it by reading a forum elsewhere and editing CSS but I have had no luck with researching how to remove the site name that appears first on the left of the admin bar. Does anyone here know how I can do it?

Thanks

Dani AI

Generated

Quick, reliable fix (for — building on ’s suggestion to edit functions.php)

The admin bar is built from named nodes (the leftmost “Site Name” is added by core as the site-name node), so the cleanest way is to remove that node via the Toolbar API rather than hide it with CSS. Add a tiny function (preferably in a child theme’s functions.php or a small site-specific plugin) that removes the site-name node before the bar renders:

function dw_remove_site_name_admin_bar() {
    global $wp_admin_bar;
    if ( ! is_object( $wp_admin_bar ) ) {
        return;
    }
    $wp_admin_bar->remove_node( 'site-name' );
}
add_action( 'wp_before_admin_bar_render', 'dw_remove_site_name_admin_bar' );

Use the wp_before_admin_bar_render hook because core builds the bar during admin_bar_menu and then fires wp_before_admin_bar_render right before output; removing the node there is reliable across versions. See the admin-bar source for the site-name item and the Toolbar API docs for remove_menu/remove_node. (Official references: wp-includes/admin-bar.php, wp_admin_bar_render / hooks guidance, WP_Admin_Bar::remove_menu). (developer.wordpress.org)

Troubleshooting: if the item still appears, a plugin or theme may re-add it with an unusually high priority — try attaching to admin_bar_menu with a very large priority (e.g., 9999) and accept the $wp_admin_bar parameter. If you hid the label with CSS before, you may still see an empty gap because WP inserts page padding for the admin bar; to remove that bump use your theme support callback (see add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) )). (developer.wordpress.org)

Keep edits out of parent-theme files (use a child theme or plugin) and prefix function names to avoid collisions. This approach removes the node cleanly rather than relying on fragile CSS.

Hi

I don't see a site name on the admin bar in any of my word press installations, however, all my wp installations is done on their own domains, so I am not sure to what you refer to if you try to remove the site name from admin bar?

In the admin section, the site link appears on the left hand side of the wphead but I gather you are talking about the admin bar that shows when you logged in and browsing the site itself?

To ad and remove stuff from the admin bar is relative easy, you edit the theme's functions.php file and the following website will show you some handy code to do it:

http://wp-snippets.com/addremove-wp-admin-bar-links/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.