[wp-hackers] What hook is triggered by a scheduled post going live?
aesqe
aesqe at skyphe.org
Wed Mar 2 18:31:32 UTC 2011
you can use the 'transition_post_status' hook.
function filter_action_transition_post_status( $new_status, $old_status,
$post )
{
if( 'publish' == $new_status && 'future' == $old_status )
{
// do something
}
}
add_action('transition_post_status',
'filter_action_transition_post_status', 10, 3);
On 2.3.2011 19:24, Christopher Ross 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?
>
> c.
>
>
> __
>
> Christopher Ross
> Online Portfolio - http://christopherross.ca
> Personal Blog - http://thisismyurl.com
>
> Fredericton - 506.238.4461
> San Diego - 858.201.4912
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
More information about the wp-hackers
mailing list