

The info I was looking for was whether, when toggled on, it would display both the published and modified dates, or display the modified date instead of the published date, as from the settings alone it’s not immediately clearCommenting on that issue, Ronnie Burt said:
Feedback after using this block on multiple sites in templates for both posts and pages. The ‘modified date’ block doesn’t show anything if the post has never been updated. This makes it really challenging to use, as there will be a blank spot on the front end for new posts or pages without any edits. It would be more useful to show the date published if the post has no edits.Carolina responded:
The problem is that there is no one scenario that will work for all use cases. Some users and designs wants to display both the original publishing date and the modified date. So no matter how this block is updated, it will break for someone. Your best option may be to register a block binding with a callback function that displays the post date, to get the exact conditions that you need, and then insert a paragraph with this block binding, instead of using the post date block.A few months later, when I discovered the issue, I commented:
To me it seems like the block should facilitate showing the published date and then also show the modified date if it is different, with a prefix like “Updated: ” or some other parenthetical treatment. I don’t think the modified date should ever take over the published date. I’m not sure the best way to achieve that other than by adding a plugin which filters the Date block to append the desired content. I’m not sure how that could be handled in the UI, given we’re dealing with inline content and there is no ability to hide blocks (cf. #50756), and there’d have to be a condition like “Only show this block if the rendered date/time of the published date is not the same as the rendered date/time of the modified date.”So this is what I wanted, but the Date block didn’t support it. So I started exploring something that would implement my desired use case. Accounting for all the different scenarios adds complexity to the block. Rendering a single publish date or modified date is simple enough. But if the modified date needs to be displayed conditionally then how is this configured in the editor? Namely, if both dates are displayed, then one or both of the dates would need to have some prefix indicating what the date refers to. The two configurations I had in mind were prefixing the modified date only:
December 25, 2025 (Modified: January 1, 2026)Or else putting each on a separate line and having prefixes for each:
Published: December 25, 2025There is an existing Gutenberg issue #61920 which is about adding prefixes and suffixes to the block similarly to the Categories block. But these prefixes are unconditional for only a single date. I wanted these prefixes added conditionally for when the modified date is displayed in addition to the published date.
Modified: January 1, 2026
A New Plugin
Ultimately, I put together a plugin to implement what I wanted: Post Date Block: Published & Modified. It’s currently on GitHub but I’ve also submitted it to the WordPress.org directory.Show modified date when different from published dateThe two dates are rendered in the supplied date format, and only if they then differ will the modified date be displayed after the published date. This prevents the modified date from appearing as a duplicate when the post is updated on the same day it was published. When that toggle is enabled, two new sets of fields are presented for adding a prefix and suffix to both the published date and the modified date. There is also a toggle for whether the modified date should be displayed on a separate line. Here are the settings for the two configurations I mentioned previously, one where the modified date is displayed on a separate line and another where it is displayed on the same line:


<div class="wp-block-post-date">
<time datetime="2025-12-25T18:14:21-08:00">
December 25, 2025
</time>
</div>
And here is how the block is rendered after having been modified on New Year’s Day, in the two-line configuration:
<div class="wp-block-post-date post-date-modified">
Published:
<time class="entry-date published" datetime="2025-12-25T18:14:21-08:00">
December 25, 2025
</time>
<br>
<span class="modified">
Modified:
<time class="updated" datetime="2026-01-01T21:20:05-08:00">
January 1, 2026
</time>
</span>
</div>
Note the added microformat classes to disambiguate the published date from the modified date. I was really happy to be able to leverage the HTML Tag Processor to handle insertion of the prefixes, suffixes, newline, and class names!
This plugin solves my use case, but it’s primarily a prototype/stopgap until something lands in core. The user experience for this doesn’t feel ideal, but I can’t think of a better option at the moment. Note also that there is currently no preview in the editor, so you have to save the changes and go to the frontend to see the results. (My Customizer self weeps.) I didn’t want to fork the Date block’s edit function to implement full preview in the editor, and it would be of little value anyway since when editing a block template the Date block now just shows ”Invalid date” anyway due to there being no post context for the block binding.
The Future
The ideal solution perhaps would involve Bits (now Shortblocks). Maybe the default view for a Post Date block when editing a block template would be to show the view when the modified date is the same as the published date. But then there could potentially be a popover that could allow configuring how the block should render when the modified date is different. With Shortblocks, these tokens could be inserted inline with the content and moved around inside of a paragraph block. This would avoid the need to supply a suffix/prefix in the detached block settings sidebar. In the meantime, I hope my plugin is helpful for keeping your readers updated!Where I’ve posted about this:
The post Post Date Block: Published & Modified appeared first on Weston Ruter.















Leave a Reply