Say adios to howdy in WordPress admin

Whilst I personally don’t have a problem with it, some clients just plain don’t like the Howdy in the WordPress admin bar. Maybe it’s too familiar, too casual, too… American. Whatever the reason, satisfaction is just a few lines of code away.

The Howdy text is translated into other languages through the WordPress interface to gettext() that helps you provide translations for any text used in WordPress and its plugins, so we can just provide an alternative translation to get rid of Howdy. Rather than go to the trouble of customising a gettext file, the simple path to happiness is through hooks — “there’s a hook for that.”

The text in question is ‘Howdy, %1$s’, which we just need to check for in our hook and replace with our preferred text:

/**
* filter translations, to replace some standard WP text with our own
* @param string $translation the translated text
* @param string $text the text before translation
* @param string $domain the gettext domain for translation
* @return string
*/
function say_adios_to_howdy($translation, $text, $domain) {
    if ($text == 'Howdy, %1$s')
        $translation = 'G\'day, %1$s';

    return $translation;
}

add_filter('gettext', 'say_adios_to_howdy', 10, 3);

There, job is done… mate!

Facebooktwittergoogle_plusredditlinkedinmailFacebooktwittergoogle_plusredditlinkedinmail