I am writing a wordpress plugin. I would like to to set the post status to publish if post status is future.
I know one hook that is to be used that is pre_post_update.
However where is the array of post related details stored so that I can change the post_status?
Thanks for the help
The function that calls the pre_post_update hook appears on line 1525 of wp-includes/posts.php for me:
As you can see, it passes the ID of the post being updated when it is executed. To get the post from there, you would just call
get_post()
, e.g.:The
$post
variable above should reference an object with all of the various attributes about a post you are looking for, hopefully.