How To Change The Howdy Text In WordPress Admin Menu Bar

If you’re tried to customize the back-end of wordpress. Then you may have used some custom widgets, remove menu items or custom write panels. It’s looking worst in wordpress admin bar see the text in the top-right. Normally it says Howdy, Username. Now we’re going to change it to the Welcome, Username.

 

 

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

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

}
}