KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to Change WordPress Comment Date Format?

Category: WordPress
Tags: # # #

WordPress comments are governed by the same setting as controls dates in all parts of the system, and can be accessed via the WP admin panel:

  Settings -> General

Once there, scroll down to the Date Format section, where there are numerous choices available as defaults and a custom field where you can specify the date in exactly the format you prefer. This includes the Month, Day, Day of the Week and Year as well as separators, such as commas, dashes or slashes.

The WordPress comment date year can be either 4 digits or 2 digits:

  Y - 4 digits - example 2020
  y - 2 digits - example 20

The month can be a number from 1-12, with or without leading zeros or can be the full name of the month, or 3 letter shortened version:

  F - Full month name - example January
  M - 3 letter month name - example Jan
  m - number with leading zeros - 01
  n - number with no leading zeros - 1

Day of the week can be spelled out as either the full name of the day or three letter shortened version:

  l - (lower case L) - Full day of the week name - example Thursday
  D -                - 3 letter day of the week name -     Thu

Day of the month can be numeric (1-31) and can include leading zeros, if desired. The English suffix can be tacked on at the end for a bit of beautification as well:

  d - numeric with leading zeros - example 09
  j - numeric without leading zeros - 9
  S - suffix (st, nd, rd or th) - 9th

Note: the “S” suffix needs to be used in conjunction with either the d or the j specifier. So, in the example above, you would use “jS” to get 9th, or “dS” to get 09th.

An example of the full format string could be:

  l, F jS, Y

This would result in:

  Friday, September 24th, 2004

For additional information on date formats (which happen to be derived from the PHP functions surrounding date and time), check out the wordpress.org article regarding: Formatting Date and Time

How to Change WordPress Comment Date Submitted?

There could be occasions when you would like to alter the date a comment shows as submitted, either moving it back or forward in time. Since WordPress admins can edit comments, this change isn’t terribly difficult.

Starting in the WordPress admin panel, open comments, then navigate to the comment you’d like to adjust before clicking on Edit.

There’s an entire section about the comment called Status. Within that box you can adjust whether a comment is Approved, Pending or Spam as well as setting the Submitted On date.

Click on the Edit link next to the Submitted On date and time. This will give you the option to adjust the Submitted On date, as well as time, to whatever you choose.

Click Update to save changes.

Note: As with many database changes, it may not appear visible in your browser until after you’ve cleared browser cache, any WordPress plugins cache and possibly web hosting caching.

How to Change WordPress Comments Date Ordering?

Comments in WordPress can easily be ordered so that either the newest display at the top of the list or the oldest display at the top, all without need for any plugins or code changes.

Whether you’d like comments displayed chronologically or reverse chronological, it’s just one small change.

To modify the comment date ordering behavior, go to WordPress admin and select:

  Settings -> Discussion -> Other Comment Settings

Look for the line:

Comments should be displayed with the _ comments at the top of each page

There’s a dropdown where you can select older or newer, depending on how you’d like them to display.

Then click Save Changes at the bottom of the page.

Note: This will impact the display of all comments sitewide. Also, you may need to clear cache in order for the change to appear in your browser.