0

Am I correct in understanding that the publish date and the modified date are actually the same thing under the covers in WP?

We have a need to show “this article was last updated on”, which could be 2018 December. But the edit to put this date in our content could be done today, in April 2022. If we change the official modified date to be shown to the world (2018), by changing the publication date in WP, it doesn’t work as it always updates internally the modified date today and the sorting order even by “publish date” seems to reflect the modification today instead of the 2018 days I put in that article.

Am I doing something wrongly? How can we put in a custom publication date in the last while still retaining that this modification was done today?

I’ve tried using “modified” and “publish_date” in the WP Query and the results are confusing.

1
  • So: 1. Publish date should be stable. 2. Modified date keeps up to date and is shown on the site.
    – Khom Nazid
    Apr 13, 2022 at 20:43

1 Answer 1

1

The publish date is either when the post is originally published, or the date that you choose to set it as published in the Editor, so that is the part you can manually control. The modified date is whenever an update has most recently occurred, such as when the Update button is pressed in the Editor.

You might end up wanting to add a custom field to hold a "public date." The downside there is it would be stored in postmeta, making your queries less performant. Another alternative would be adding custom code that adds a date control in the Editor and forcibly sets the modified date to whatever you are choosing manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.