I often update my older posts with additional information to keep them fresh and accurate. I include both the “Published” date and “Last Updated” date at the top of posts so users know the history and accuracy of the article.
The WordPress function get_the_modified_date()
can be used to list this date, but there’s one small problem. It changes for any update, no matter how minor.
If I’m fixing a typo or adjusting the categories on the post, I don’t want the modified date to change. So I built a plugin.
Limit Modified Date
This plugin works with both the Gutenberg block editor and classic editor.
This plugin adds a checkbox to the Publish box that lets you prevent the modified date from updating. Leave this checked while you’re making your minor content changes.
When it’s time for a notable content update, uncheck the box and save the post.
Gutenberg Compatible
Whether you’re using the Classic Editor or the new Gutenberg block editor, this plugin will work great for you.
Check all posts
If you would like to automatically check this box on all of your current posts, you can run this command in wp cli:
for id in $(wp post list --post_type=post --format=ids); do wp post meta update $id limit_modified_date 1; done
Thanks @JiveDig for the tip!
Chris Brailsford says
Hey Bill, quick question: if the checkbox is already set for the post and someone modifies the tags via the Quick Edit box on the All Posts listing, will it still prevent the modified date from changing?
Funny enough, I was just thinking about this problem the other day!
Bill Erickson says
Yes, the plugin will prevent the modified date from updating, even for the Quick Edit box.
At least it’s working in my testing, but I haven’t used this plugin anywhere other than my site yet.
If you do find issues, please let me know!
Andrew says
Great plugin. I’ve always hated that simply fixing a typo or some other minor thing changed the modified date. I installed it about 2 seconds after I found this post.
One very small thing: In your description you refer to “unchecking the check box” to update the modified date, which makes sense (rather than checking the box each time). But the checkbox is not checked by default. I made the change in my limit-modified-date.php file but thought i’d point it out to you as well.
Bill Erickson says
Correct, I didn’t want to change the default saving functionality for all article immediately. You must enable it for the article by first checking the box. Once it is checked, it remains checked until you uncheck it, which is what I was describing.
Daniel says
That’s an awesome plugin, thanks!
Is it possible to have check all posts by default without using wp cli?
By editing a certain line of “limit-modified-date.php”?
Bill Erickson says
At this point, no, but it’s definitely on my list of features I would like to add to the plugin.
Kerri says
Hi Bill, do you know why Google won’t pick up the modified date in its serps though?
Bill Erickson says
You might try pinging Casey Markee or Jeff Hawley, two SEO experts, on Twitter. They know more about how Google decides what date to include.
My understanding is you can increase the chance Google will highlight your modified date if you include it in the post instead of the published date (example).
Daniel says
Hey Bill!
This plugin stopped working when using the new/default WordPress-Editor (latest WP Version Dec 2020).
It only works in combination with the plugin “Classic Editor”…
Any chance for an update? 🙂
Thanks!
Bill Erickson says
It’s working for me with the latest version of WordPress, but I’ll do a bit of digging to see if anything needs changing. Do you see any console errors? It could be a plugin conflict.
Daniel says
Hi Bill!
I have to correct myself a little bit.
When deactivating the “Classic Editor”, the checkboxes are still checked, but when you update/save the article it changes the Last Modified date, although the checkbox is checked.
The solution is to uncheck and check the checkbox again and then it works like before.
So there seems to be some issue when switching from the Classic Editor to the new/default one. But I don’t know if it can be solved through an update.
Anyways, I found a solution as mentioned above! 🙂
JiveDig says
Hey Bill/Daniel,
I’m just here to same that I’m seeing the same issue here. We have to uncheck then check, otherwise it’s updating the modified date.
Seth Spears says
I’m having the same issue since we moved over to the block editor on https://wellnessmama.com. Is there a fix for this?