I would like to collect main info about post like Title etc. in moment when post was written and it's going to be published and perform some actions on this data. What's the hook for that?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
The function is
wp_insert_post(), and as you can see there are some hooks you can use to modify data.
wp_insert_post_data is a filter that gets all data right before it will be inserted into the database, so you modify it there and don't need to do anything to get it saved. At the end of the function you can see the
save_post action and its equivalent
wp_insert_post, which are more appropriate if you want to do something (instead of change something).
These functions are fired when a post is saved, not only when it is published. For the publish action, look at
wp_transition_post_status(), which has three hooks:
transition_post_status, called with the new and old statuses, and the post data
draft_to_publish, called with the post data
publish_page, called with the post ID and post data
Also check here: WordPress prompt checklist before publish? "WordPress prompt checklist before publish?"