How to change "Howdy" message in admin bar ?

by   SJRANJAN

To change / remove howdy message from the admin bar, paste the following code inside your theme or any active plugin.

Code

function change_admin_bar_howdy_message( ) {
    global $wp_admin_bar;
    $my_account_section = $wp_admin_bar->get_node('my-account');
    $howdymessage = str_replace( 'Howdy,', 'welcome', $my_account_section->title );            
    $wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $howdymessage
    ) );
}
add_filter( 'admin_bar_menu', 'change_admin_bar_howdy_message',25 );
 

The snippet will change "Howdy," message to "welcome". You can add your word by modifying "welcome" or if you do not want any message to be displayed just leave the second attribute empty in str_replace function.

Concept

Global variable $wp_admin_bar holds the default definition of admin bar. By the above code snippet we force wordpress to execute our function change_admin_bar_howdy_message on admin_bar_menu action, where our snippet does changing howdy text.