WP admin bar – How to hide/replace WordPress icon and blavatars – updated


At the left side of wp admin bar an wordpress icon “W” is shown.

When the user hover it, it lists some wordpress.org links.  Also in multisite installation a wordpress logo (called blavatar) is shown next to each blog name. Also if you have buddypress installed the same blavatar appears in the admin members stats metabox.

A simple way to hide those images or/and replace them with your site favicon is the following.

Just add the functions into your bp-custom.php (or custom.php) file the following:


/**
* Replace wordpress blavatar with site's favicon
*/
function ls_replace_blavatars() {
echo '<style>
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {content:" "!important;}
#wpadminbar .quicklinks li .blavatar:before {content:" "!important;}


#wp-admin-bar-wp-logo>.ab-item .ab-icon { background: url("/wp-content/favicon.ico") no-repeat;}
#wpadminbar .quicklinks li div.blavatar { background: url("/wp-content/favicon.ico") no-repeat;}
//for buddypress members stats metabox
div#community-profile-page li.bp-blogs-profile-stats:before {content:" "!important;}
div#community-profile-page li.bp-blogs-profile-stats {background: url("/wp-content/favicon.ico") no-repeat; padding-left:16px}
//end for buddypress stats metabox
}
add_action('admin_head', 'replace_blavatars');


/**
* Remove wordpress logo/pages from admin bar
* @global type $wp_admin_bar
*/
function ls_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'wp-logo' );
}


add_action( 'wp_before_admin_bar_render', 'ls_admin_bar_remove', 0 );