Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Could you please give an example of the action names . Will the actions triggered be "future_to_published" and "publish_post"? –  rsman Sep 8 '10 at 16:03
    
Indeed, publish_post will certainly be triggered, and future_to_publish if the previous status was future (I don't know the initial status if you publish immediately). Mike also gave some interesting hooks in an answer to a related question. –  Jan Fabry Sep 8 '10 at 19:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.