Replies: 0
In the save_post hook, how exactly does the $update parameter work?
It “seems” unstable from time to time.
I took a look in wp_insert_post, and $update is set to TRUE if the $postarr array specifies the ID.
I might be mistaken, but from a user standpoint, when you start creating a post and save it for the first time, $update must be false. However, it doesn’t always seem to be the case.
Is it because of the draft auto-save? If it is, the $update parameter is really counter intuitive.
What would be the right way to know if save_post is running an $update or not.
I’ve seen a comparison between $post->post_date and $post->post_modified but it doesn’t seem exactly right. There is the classic DOING_AUTOSAVE constant check, but I guess that funks the thing up.
Shouldn’t the $update be better designed?