How to Change the Standard WordPress Admin Greeting

How to Change the Standard WordPress Admin Greeting

I love Texas.

My sister lives in Houston, so I go there quite often. They have steak, ribs, pulled pork, beef brisket, and possibly some other non-food items that are also good. I have nothing against the word, “Howdy”. And yet, it’s not something I would ever say.

It just seems rather inappropriate, sitting there in my admin area, like a foreign imposter:

Howdy

It’s decidedly un-British (and I am British, in case you didn’t know). But whilst I don’t really care how my admin bar greets me, there are situations in which you would like it to say something a little more appropriate. If for example you were building a website for a corporate client.

Changing Your Greeting

Fortunately, changing the greeting in the WordPress admin area is a piece of cake. Your first option is a simple code snippet:

/*-------------------------------------------------------------------------*/
/* Change Standard WordPress Admin Greeting */
/*-------------------------------------------------------------------------*/

add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 );

function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) {
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$profile_url = get_edit_profile_url( $user_id );

if ( 0 != $user_id ) {

/* Add the "My Account" menu */

$avatar = get_avatar( $user_id, 28 );
$howdy = sprintf( __('Welcome, %1$s'), $current_user->display_name );
$class = empty( $avatar ) ? '' : 'with-avatar';

$wp_admin_bar->add_menu( array(
'id' => 'my-account',
'parent' => 'top-secondary',
'title' => $howdy . $avatar,
'href' => $profile_url,
'meta' => array(
'class' => $class,
),
) );

}
}

This comes courtesy of Greg Kerstin and WP Beginner. Just paste the above code at the bottom of your theme’s functions.php file, and you’re set. Obviously you can change the “Welcome” to whatever tickles your fancy.

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Your second option is to use a plugin like TM Replace Howdy. This offers you a few different options, like random greetings, custom greetings, and professional greetings:

WP Greeting
This not being an example of a professional greeting.

It’s all rather bloated and unnecessary, especially when you have a perfectly functional code snippet above. Still, now you can make the decision.

Tags: