Post Date Labels

Add your own text before or after post dates, like “Published on” or “Updated”.

Lauren Gray Avatar

Post Date Labels lets you add your own text before or after the Post Date block, like “Published on” or “(updated)”. You can set separate labels for published and modified dates, and the right one shows automatically.

Before you start

  • WordPress 5.8 or later
  • PHP 5.6 or later
  • The block editor. The labels are options on the core Post Date block.

Install

  1. In your WordPress dashboard, go to Plugins → Add New Plugin.
  2. Click Upload Plugin.
  3. Choose the plugin zip file.
  4. Click Install Now.
  5. Click Activate.

There’s no settings page. Everything happens on the block.

How to use

Add labels to a Post Date block

  1. Open a post, page or template in the editor and select a Post Date block (or add one).
  2. In the block settings sidebar, open the Post Date Labels panel.
  3. Under Published Date, type text in the Prefix field (shown before the date) and/or the Suffix field (shown after it).
  4. Under Modified Date, do the same for posts showing their modified date.
  5. Save. The labels preview in the editor and appear on the front end.

On the front end, the plugin checks whether the block is showing the post’s published date or its modified date, then uses the matching labels. A space is added between each label and the date, so you don’t need to type one.

Leave any field empty to show no label there.

Use it with Post Date: Smarter Modified

If you use Post Date: Smarter Modified to show whichever date is newer, Post Date Labels picks the matching label set for whichever date is displayed. For example, set the published prefix to “Published on” and the modified prefix to “Updated on”.

Block options

All options are in the Post Date Labels panel on the Post Date block. Each one is empty by default.

  • Published Date → Prefix: text before the published date.
  • Published Date → Suffix: text after the published date.
  • Modified Date → Prefix: text before the modified date.
  • Modified Date → Suffix: text after the modified date.

Developer reference

Coming soon: the hooks, filters and functions you can use with this plugin from your theme or a code snippet.

FAQs

Can I style the labels differently?

Yes. On the front end, each label is wrapped in a span with these classes:

  • .post-date-affix: every label
  • .post-date-prefix and .post-date-suffix: all prefixes or all suffixes
  • .post-date-published-prefix and .post-date-published-suffix: published date labels
  • .post-date-modified-prefix and .post-date-modified-suffix: modified date labels
.post-date-modified-prefix {
	font-weight: bold;
}
Can I use different labels for published and modified dates?

Yes. That’s what the two groups in the panel are for. The plugin compares the date the block renders with the post’s published and modified dates and applies the matching set. If it can’t tell, it uses the published labels.