WordPress Replace "Howdy"

DSDalton SuttonMarch 19, 2024
View AllHide Notes

How To Install

  1. Open your WordPress theme's functions.php file or a plugin's PHP file.
  2. Copy and paste the provided PHP snippet into the PHP file.
  3. Save the file.
  4. Adjust as needed.
<?php 

// Not everyone is a cowboy.
function daltonsutton_replace_howdy($wp_admin_bar) {
    $my_account = $wp_admin_bar->get_node('my-account');
    $newtitle = str_replace( 'Howdy, ', 'Logged in as ', $my_account->title );            
    $wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $newtitle,
    ) );
}
add_filter('admin_bar_menu', 'daltonsutton_replace_howdy', 25);