It’s often the small things that tend to annoy us, and in the case of one client it was the “Howdy” message on the right of the WordPress admin bar. A small thing perhaps, but how can you change it, programmatically?
Fortunately help is at hand via the following snippet which should be added to your theme or child theme’s functions.php.
// Replace Howdy Greeting function replace_howdy_greeting( $wp_admin_bar ) { $my_account=$wp_admin_bar->get_node('my-account'); $newtitle = str_replace( 'Howdy', 'Welcome', $my_account->title ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $newtitle, ) ); } add_filter( 'admin_bar_menu', 'replace_howdy_greeting', 12 );
Update
It’s come to my attention that the ‘Howdy’ now says, ‘Hi’. To remove this and the trailing comma, the following code should do the trick.
// Replace Hi Greeting AND Comma function replace_hi_greeting($wp_admin_bar) { $my_account=$wp_admin_bar->get_node('my-account'); $newtitle = str_replace('Hi,', '', $my_account->title ); $wp_admin_bar->add_node(array( 'id' => 'my-account', 'title' => $newtitle, ) ); } add_filter('admin_bar_menu', 'replace_hi_greeting',12);
Nice trick Warren, but I’m looking to hide it completely, with the coma integrated. While letting the space empty, the coma still appears.
Could you show how to remove it all at once ?
Best.
I’ve updated the article to remove the message and comma. Thanks for the comment.