Customize “Howdy” message in WordPress admin area

Howdy, reader! If you have ever used WordPress, you are familiar with the greeting. It is the only greeting you can come across in WordPress, but if you want to change it, it is a good thing to know that it can be easily done.

Not only can you change standard “Howdy, username!” greeting into something else, but you can easily customize it even further.

For example, you can tell WordPress to change greetings depending on the date. This is convenient for holidays or special occasions. Wouldn’t it be neat if your WordPress knew when Christmas is coming and be the one of the first to say “Happy New year”?

But, before we get there, let’s see how to simply change the standard message.

Simple:

  1. Open your functions.php file
  2. Copy and paste the following code:
  3. function howdy_message($translated_text, $text, $domain) {
    $new_message = str_replace('Howdy', 'Hello', $text);
    return $new_message;
    }
    add_filter('gettext', 'howdy_message', 10, 3);
  4. Save changes

Of course, you are free to use any greeting message you want.

Advanced:

Now let’s go to the second part of the customization we talked about. If you want to customize greeting message according to holidays, you will need the following code:

  1. Again, open functions.php file
  2. Copy and paste the following code:
  3. function public_holiday() {
    $date = date('d-m');
    switch($date) {
    
    case '01-01':
    $message = 'Happy New Years';
    break;
    
    case 'your_birth_day_here:
    $message = 'Happy Birthday';
    break;
    
    case '05-05':
    $message = 'Happy Cinco de Mayo';
    break;
    
    case '05-026':
    $message = 'Happy Memorial Day';
    break;
    
    case '07-04':
    $message = 'Happy 4th of July';
    break;
    
    case '09-01':
    $message = 'Happy Labor Day';
    break;
    
    case '10-31':
    $message = 'Happy Halloween';
    break;
    
    case '11-27':
    $message = 'Happy Thanksgiving';
    break;
    
    case '25-12':
    $message = 'Merry Christmas';
    break;
    
    default:
    $message = 'Hello';
    }
    
    return $message;
    }
    
    function howdy_message($translated_text, $text, $domain) {
    $message = public_holiday();
    $new_message = str_replace('Howdy', $message, $text);
    return $new_message;
    }
    
    add_filter('gettext', 'howdy_message', 10, 3);
  4. Save changes

You are free to add any dates that you want simply by adding a new case in the code. Also, you can change the default message from “Hello” to anything else if you want to.

It seems like a long code, but everything was fairly simple, right?

If you want to further customize messages in WordPress, you might be interested in changing standard admin footer text. If you like customizing WordPress, check the WordPress basics and our other tutorials and plugin lists that will help you do practically whatever you want with your site.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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