Replace the "Howdy" Greeting
Changes the "Howdy, name" text in the top right of the admin bar to a greeting of your choice.
Opens WPIDE on
Code
add_action( 'admin_bar_menu', function ( $admin_bar ) {
$node = $admin_bar->get_node( 'my-account' );
if ( ! $node || ! is_user_logged_in() ) {
return;
}
$user = wp_get_current_user();
$greeting = 'Welcome back,';
$admin_bar->add_node( array(
'id' => 'my-account',
'title' => esc_html( $greeting ) . ' <span class="display-name">' . esc_html( $user->display_name ) . '</span>' . get_avatar( $user->ID, 26 ),
) );
}, 9999 );
Notes
Edit $greeting.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.