Lego2012
12/13/2016 - 9:47 AM

Admin and Dashboard - Replace "Howdy" with "Logged in as" in WordPress bar

Admin and Dashboard - Replace "Howdy" with "Logged in as" in WordPress bar

<?php
// Do NOT include the opening php tag

<!--
If the default "Howdy" is too informal or you just want another message on the WordPress menu bar, head over to your functions.php and add this: 
  -->

function 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', 'replace_howdy',25 );

<!--
You just need to insert your new message as the 2nd element within the $newtitle array, and you're done. 
-->