What function can be used to update a post’s post date and time to the current date & time?
Leave a Reply
You must be logged in to post a comment.
What function can be used to update a post’s post date and time to the current date & time?
You must be logged in to post a comment.
Call
wp_update_post()
with a special value for'post_date'
and'post_date_gmt'
:The selected answer is perfect for modifying the “publish date”, but in my case I wanted to change the “last modified” date (
post_modified
andpost_modified_gmt
in the db). The following is sufficient for that: