Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AppleDApp

macrumors 68020
Original poster
Jun 21, 2011
2,413
45
I tried following this posts tutorial HOW TO CHANGE THE WORDPRESS “HOWDY” MESSAGE TO A CUSTOM WELCOME

I created a functions.php file inserted the code and saved. Once I did that I got a strange message on my page and the Howdy message remained. I have since deleted my functions.php file in the hope of removing the text but it is not working.

Code:
add_filter('gettext', 'change_howdy', 10, 3);

function change_howdy($translated, $text, $domain) {

    if (!is_admin() || 'default' != $domain)
        return $translated;

    if (false !== strpos($translated, 'Howdy'))
        return str_replace('Howdy', 'Welcome', $translated);

    return $translated;
}

Fixed The functions file was not properly deleted.

This thread may be archived or sent to the wasteland.
 

Attachments

  • Screen Shot 2016-01-21 at 11.03.09 AM.jpg
    Screen Shot 2016-01-21 at 11.03.09 AM.jpg
    47.5 KB · Views: 365
Last edited:
I tried following this posts tutorial HOW TO CHANGE THE WORDPRESS “HOWDY” MESSAGE TO A CUSTOM WELCOME

I created a functions.php file inserted the code and saved. Once I did that I got a strange message on my page and the Howdy message remained. I have since deleted my functions.php file in the hope of removing the text but it is not working.

Fixed The functions file was not properly deleted.

This thread may be archived or sent to the wasteland.
Did you remember the opening <?php at the beginning of your functions.php file?
 
I think the problem with the method you tried is that it filters using gettext, which I believe is called by WP for every text render context, not just the admin bar, but also menus, post contents, etc.

Just modify the $wp_admin_bar object itself (ref: https://codex.wordpress.org/Class_Reference/WP_Admin_Bar).

Here's one example from the web:

Code:
add_filter('admin_bar_menu','change_howdy_text_toolbar');
function change_howdy_text_toolbar($wp_admin_bar)
{
    $getgreetings = $wp_admin_bar->get_node('my-account');
    $rpctitle = str_replace('Howdy,','',$getgreetings->title);
    $wp_admin_bar->add_node(array("id"=>"my-account","title"=>$rpctitle));
}

Note: I have no idea where the built in WP_Admin_Bar menus are defined, but apparently, 'my-account' is a menu item pre-defined and the node that needs to be altered.
 
I think the problem with the method you tried is that it filters using gettext, which I believe is called by WP for every text render context, not just the admin bar, but also menus, post contents, etc.

Just modify the $wp_admin_bar object itself (ref: https://codex.wordpress.org/Class_Reference/WP_Admin_Bar).

Here's one example from the web:

Code:
add_filter('admin_bar_menu','change_howdy_text_toolbar');
function change_howdy_text_toolbar($wp_admin_bar)
{
    $getgreetings = $wp_admin_bar->get_node('my-account');
    $rpctitle = str_replace('Howdy,','',$getgreetings->title);
    $wp_admin_bar->add_node(array("id"=>"my-account","title"=>$rpctitle));
}

Note: I have no idea where the built in WP_Admin_Bar menus are defined, but apparently, 'my-account' is a menu item pre-defined and the node that needs to be altered.

Ocabj thanks for the reply I will look into this when I get my Wordpress from my other thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.