Welcome Prefix

function replace_prefix( $wp_admin_bar ) {
 $my_account=$wp_admin_bar->get_node('my-account');
 $newtitle = str_replace( 'Hi,', 'Logged in as', $my_account->title );
 $wp_admin_bar->add_node( array(
 'id' => 'my-account',
 'title' => $newtitle,
 ) );
 }
 add_filter( 'admin_bar_menu', 'replace_prefix',25 );

It’s the little things that make me happy. Like controlling the WordPress prefix to the username in the admin bar. Here from a simple “Hi” to a “Logged in as” notification.

Author: Andy

Actually have no idea what I am doing. Live in Sheffield with my wife and three kids. That's about all there is to it.

Leave a Reply

Your email address will not be published. Required fields are marked *