Any Hook Called When Post Becomes Published?

Posts may be published either immediately or in the future.

Suppose a plug-in wants to do something at the moment when the post becomes published and visible on the blog (I don’t mean when the post is saved as published in the admin panel with whatever date). Is there a hook like “post_visible” or something similar.

Related posts

Leave a Reply

1 comment

  1. Every time a post changes status, wp_transition_post_status function will be called. This triggers the actions ${old_status}_to_${new_status} and ${new_status}_${post->post_type}, so for example publish_post will be triggered here. A post with a date in the future will have the status future until it is actually published, so this should work for you.