Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Change the Howdy Text in WordPress 3.3 Admin Bar

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Change the Howdy Text in WordPress 3.3 Admin Bar

Have you ever worked with a client where you are trying to customize the WordPress back-end experience for them? Maybe you added a custom dashboard widget, removed menu items, or even created custom write panels. Well Greg Kerstin (@graphicagenda) was working on a project where he wanted to modify the howdy text in the WordPress admin bar. Normally it says Howdy, Username. He was kind enough to submit a snippet to us in which he shows how to change the howdy text and replace it with Welcome.

Change Howdy to Welcome

All you have to do is paste the following code in your theme’s functions.php file, or create a site plugin.

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,
),
) );

}
}

And you are done.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. simon says:

    hello can anyone help me?
    I want to translate a string in wordpress theme
    //
    if($mt_o[‘mt_rewrite_doctor_name’]!=””) { $mt_cpt_doctors_name = $mt_o[‘mt_rewrite_doctor_name’]; } else { $mt_cpt_doctors_name = “Staff'”;}
    //
    i translated such :
    if($mt_o[‘mt_rewrite_doctor_name’]!=””) { $mt_cpt_doctors_name = $mt_o[‘mt_rewrite_doctor_name’]; } else { $mt_cpt_doctors_name = __(‘Staff’,’madza_translate’);}
    but it does not work!!!!
    can you guy help me ? plz plz

  2. Ast says:

    It doesnt work,,, after I use this code, wordpress (Version 4.2.2) admin panel cant load,, should remove this code..

  3. David Labbe says:

    There is a much easier way to do this by using the old menu node values:

    function np_replace_howdy($wp_admin_bar){

    //New text to replace Howdy
    $new_text = ‘Welcome’;

    //Call up the ‘my-account’ menu node for current values.
    $my_account = $wp_admin_bar->get_node(‘my-account’);

    //Replace the ‘Howdy’ with new text with string replace
    $new_title = str_replace(‘Howdy’, $new_text, $my_account->title);

    //Rebuild the menu using the old node values and the new title.
    $wp_admin_bar->add_menu(array(
    ‘id’ => $my_account->id,
    ‘parent’ => $my_account->parent,
    ‘title’ => $new_title,
    ‘href’ => $my_account->href,
    ‘group’ => $my_account->group,
    ‘meta’ => array(
    ‘class’ => $my_account->meta[‘class’],
    ‘title’ => $my_account->meta[‘title’],
    ),
    ));
    }

    add_action(‘admin_bar_menu’, ‘np_replace_howdy’, 999);

    See my gist:

    https://gist.github.com/Davidlab/8460a3cec27cb585d95c

  4. Gauranga says:

    I tried but it didn’t work.. kept saying error and when tried to repair it, my WordPress admin panel couldn’t load any more :-( I had to switch back to my back up functions.php file (fortunately i had it). Perhaps i made a mistake but it would be nice to have something that is really copy and paste for neophytes like myself with clear instructions instead of expecting everyone to know something else that may be common sense for those who know codes. Gauranga.

  5. Sanskar says:

    Can we make it change each time to say hello in different languages?

    • WPBeginner Support says:

      Yes, you can. It may be a little complicated but do able. You will need to create an array in PHP with greetings in different languages. Then randomly pick a string from the array and use it with the rest of the code above.

  6. NATHAN says:

    Wow…! Thank you genius..,

  7. Lee says:

    Perfect! Thank you.

  8. iTechRevo says:

    Hey in the admin panel howdy can be edited but on the front end howdy is still there and cannot be changed so what should i do to edit it?

  9. graphicagenda says:

    @senlinonline: That is a great snippet! but it reverts back to the howdy for the frontend admin bar while logged in.

  10. senlinonline says:

    Changing “Howdy” can actually be done quite a bit simpler than the above code. Add this to your functions.php (or functionality.php or any other file): /** CHANGE HOWDY – http://wpmu.org/daily-tip-how-to-change-the-wordpress-howdy-message-to-a-custom-welcome/ **/add_filter(‘gettext’, ‘change_howdy’, 10, 3);function change_howdy($translated, $text, $domain) { if (!is_admin() || ‘default’ != $domain) return $translated; if (false !== strpos($translated, ‘Howdy’)) return str_replace(‘Howdy’, ‘Welcome back’, $translated); return $translated;}/** END CHANGE HOWDY **/

  11. Sean 'Wordpress Guy' Vosler says:

    I know, actually had a client ask me if it was made by a southern company because when I was signed it in said ‘howdy’, had a good laugh, but def something to do if your not positive on how a client might react

  12. WPBeginner - WordPress for Beginners says:

    Sean ‘WordPress Guy’ Vosler for the sake of customization? Not everyone thinks that Howdy is cool. Greg said he will be sending us a more detailed tutorial on how he added more links and such.

  13. timgordons says:

    Cool Tutorial. Just love it. Thanks! for this

  14. Maximiliano Noriega says:

    Wow, great tip

  15. Sean 'Wordpress Guy' Vosler says:

    why would you want to change this??? :p

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.