How to Fix Missing Post Dates in Your WordPress Theme

The problem:
When you have multiple posts published on the same day, the post date only shows up for the first one when you view the posts on your site.

The fix:

  1. Go to “Appearance > Editor” and repeat the following steps for each of your theme files
  2. Look for instances of this code:
    <?php the_date(); ?>
  3. Replace that code with this code:
    <?php echo get_the_date(); ?>
  4. Click “Update File”

The explanation:
Most WordPress template tag functions that start with “the_” will merely output the values returned by their equivalent “get_the_” functions. However, “the_date()” is an exception to this standard because it adds functionality that’s not present in “get_the_date()”, namely, not outputting the same date more than once per page, which can be a feature or an annoyance depending on your desired functionality.


  1. Glad to see you back online with your blog John, I know you have an eager audience out there just waiting to glean the tips you share.

    Great stuff as always.

    All the best!

  2. Also, while it may seem unintuitive, you could also use the the_time() template tag, which despite its name will output any PHP date() string format. For example: the_time( get_option( 'date_format' ) ) will output the date, using the user-configured date format.

  3. Also worth noting that the_date() has always had this behavior, while get_the_date() was only added recently to offer a way to fetch the date without the once-per-day aspect. The fact that it is named like most other template tag getters can be confusing, but we didn’t have any better ideas.

  4. Isn’t that what the_time() is used for?

  5. Thank you Andrew Nacin, your comment just saved me a headache.

Leave a Reply

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