• Hi,

    I was wondering if there is a way to default the last edited date to the date specified as the “Published Date” when creating a new post

    E.g if I create a new post and set the Published Date to 1st January 2012, rather than the last edited date showing as today – It would default to back then.

    This would only apply to when a new post is created, and normal procedure would continue when a post is updated in the future.

    Regards,
    Ben

Viewing 1 replies (of 1 total)
  • Anonymous User 14808221

    (@anonymized-14808221)

    You’d have to deploy some custom code for that.

    If you are comfortable with PHP and coding, you can hook into the save_post action.
    That action has a third argument $update which will tell your code if it is an update or fresh (new) post.

    Knowing that, you can then get the publish date and push that to the last edited date.
    To do that you will want to use the post_date and post_modified as well their _gmt counterparts, namely post_modified_gmt and post_date_gmt Post Object properties, which will be available from the second argument of save_post hook (it is the Post Object, that has all post data in it)

    More info on the save_post hook here.

Viewing 1 replies (of 1 total)
  • The topic ‘Last Edited Date & Created Date’ is closed to new replies.