Change Howdy User Greeting Message on WordPress Admin Bar

“Howdy, $user” is the default greeting message on the top right corner after successful user login. I didn’t give it a second thought until today. I got a request asking me to change the greeting from “Howdy” to “Hello”.

Sounds simple?

It is simple, indeed. There are more than one plugin to do just this simple task. You can check this plugin out at WordPress.org:

Edit Howdy: https://wordpress.org/plugins/edit-howdy/

Of course, if you want to expand your own WordPress snippet collection, and dig deeper about WordPress, let’s do it with code.

Here is the code snippet. Copy and paste it into the theme function.php, or your custom plugin to see it works.

// Change login greeting
function custom_replace_howdy( $wp_admin_bar ) {
	$my_account=$wp_admin_bar->get_node('my-account');
	$newtitle = str_replace( 'Howdy', 'Hello', $my_account->title );
	$wp_admin_bar->add_node( array(
		'id' => 'my-account',
		'title' => $newtitle,
	) );
}
add_filter( 'admin_bar_menu', 'custom_replace_howdy', 12 );

 

Comments are closed.

Post Navigation