[wp-hackers] What hook is triggered by a scheduled post going live?

Andrew Nacin wp at andrewnacin.com
Wed Mar 2 18:59:26 UTC 2011

On Wed, Mar 2, 2011 at 1:24 PM, Christopher Ross <cross at thisismyurl.com>wrote:

> I'm trying to write a piece of code that triggers when a blogger's
> scheduled post goes live. Do anybody know what hooks are triggered at that
> point?
> For example, when a post is made live during an edit I can hook with :
> add_action('wp_insert_post', 'send_report');
> add_action('new_to_publish' , 'send_report');
> add_action('draft_to_publish' , 'send_report');
> add_action('private_to_publish', 'send_report');
> add_action('xmlrpc_publish_post', 'send_report');
> add_action('publish_phone', 'send_report');
> add_action('publish_post', 'send_report');
> I'd tried with:
> add_action('pending_to_publish', 'send_report');
> but it doesn't seem to trigger, can anybody suggest another hook or method
> that would trigger when a scheduled post goes live?

Here's what gets trigged in wp_transition_post_status():

do_action('transition_post_status', $new_status, $old_status, $post);
do_action("{$old_status}_to_{$new_status}", $post);
 do_action("{$new_status}_{$post->post_type}", $post->ID, $post);

You're specifically looking for future_to_publish.


More information about the wp-hackers mailing list