Change Howdy Welcome Message on WordPress Admin Bar

/Change Howdy Welcome Message on WordPress Admin Bar

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);
2018-11-07T01:06:41+00:00July 7th, 2017|WordPress Snippets|2 Comments

About the Author:

Warren Chandler is a freelance web programmer and web developer, based in Frinton on Sea, Essex. Warren specialises in web programming, web design, corporate identity, copy writing, SEO, logo and print media for home, work, and mobile platforms.

2 Comments

  1. Thibault de Changy March 17, 2018 at 11:02 pm - Reply

    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.

    • Warren Chandler March 19, 2018 at 2:08 am - Reply

      I’ve updated the article to remove the message and comma. Thanks for the comment.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.