Created
February 18, 2015 13:56
-
-
Save Davidlab/8460a3cec27cb585d95c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function np_replace_howdy($wp_admin_bar){ | |
//New text to replace Howdy | |
$new_text = 'Welcome'; | |
//Call up the 'my-account' menu node for current values. | |
$my_account = $wp_admin_bar->get_node('my-account'); | |
//Replace the 'Howdy' with new text with string replace | |
$new_title = str_replace('Howdy', $new_text, $my_account->title); | |
//Rebuild the menu using the old node values and the new title. | |
$wp_admin_bar->add_menu(array( | |
'id' => $my_account->id, | |
'parent' => $my_account->parent, | |
'title' => $new_title, | |
'href' => $my_account->href, | |
'group' => $my_account->group, | |
'meta' => array( | |
'class' => $my_account->meta['class'], | |
'title' => $my_account->meta['title'], | |
), | |
)); | |
} | |
add_action('admin_bar_menu', 'np_replace_howdy', 999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment