Replace Howdy Admin in WordPress Admin Bar

[ad_1]

Although it’s not really a huge deal but some people might want to replace the default welcome message “Howdy, admin” in the WordPress admin bar.

To replace “Howdy, admin” in WordPress admin bar, you can use this code snippet below. Using this snippet now, your welcome message will read “Welcome! admin” instead of default “Howdy, admin”. You can always use some other greeting message by editing this code.

You can paste this code snippet in your theme’s functions.php file.

// replace howdy, admin in WordPress admin bar
function wcs_replace_howdy_admin( $wp_admin_bar ) {
    $my_account = $wp_admin_bar->get_node( 'my-account' );
    $new_title = str_replace( 'Howdy,', 'Welcome! ', $my_account->title );
    $wp_admin_bar->add_node(
        array (
          'id' => 'my-account',
          'title' => $new_title,
        )
    );
}
add_filter( 'admin_bar_menu', 'wcs_replace_howdy_admin', 25 );

But if you want to remove welcome message completely, then use this code snippet instead.

// replace howdy, admin in WordPress admin bar
function wcs_replace_howdy_admin( $wp_admin_bar ) {
    $my_account = $wp_admin_bar->get_node( 'my-account' );
    $new_title = str_replace( 'Howdy,', '', $my_account->title );
    $wp_admin_bar->add_node(
        array (
          'id' => 'my-account',
          'title' => $new_title,
        )
    );
}
add_filter( 'admin_bar_menu', 'wcs_replace_howdy_admin', 25 );
[ad_2]

Leave a Reply

Random Post Selection ::

Recent Posts

Unlock Unlimited Downloads