save_post hook, and I have to know inside this hook function, whether it is a publishing (
draft to publish ) or is it an updating, like
publish to publish or
draft to draft.
Is there a way to check it?
I can not use
draft_to_publish hook for this, and I'll explain why:
The users ask questions on the site, and questions are saved as
draft posts. A site admin write an answer and then publish the post. A post has
meta box "status" that can have next values: "not answered", "treatment", "answered". A site admin may change this value as he wants, but when he publish the post (draft to publish, or draft to private), this meta value must be changed automatically to "answered" (although that the
input area on admin area has another value). So I have a function that fired on
save_post hook, that save all values according to
input area values. And also I tried to use
draft_to_publish hook to assign "answered" to the meta value. The problem is that
save_post always fired after
draft_to_publish, so that the value ("answered" that assigned on
draft_to_publish) is overridden by the value of
global variable. I assign
$is_publishing_now = truein
draft_to_publishhook, and by this way can know during
save_posthook, that it is publishing now. Thank you for your answers.