WordPress Snippets at WPcustoms

Replace ‘Howdy, admin’

Customize the ‘Howdy, *username*’ text in your admin bar. This functions replaces “Howdy” with “Logged in as” – feel free to add your own text and welcome message.


/**
 * Snippet Name: Replace ‘Howdy, admin’
 * Snippet URL: http://www.wpcustoms.net/snippets/replace-howdy-admin/
 */
 function wpc_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', 'wpc_replace_howdy',25 );