[wp-hackers] Scheduling of future posts with a different post_type.

Otto otto at ottodestruct.com
Mon Jul 14 16:35:18 GMT 2008


On Mon, Jul 14, 2008 at 10:47 AM, Jason Webster <jason at intraffic.net> wrote:
> After manually monitoring the cron array, it can definitively say it is just
> not getting added to it at all.
>
> Now, my question is, where in wp_write_post(), wp_insert_post(), or anywhere
> else for that matter, does the future publishing of a post get scheduled?? I
> can't seem to find it. Sorry if it's obvious.

It's not that obvious, actually.

wp_insert_post() calls wp_transition_post_status(), and the
wp_transition_post_status function does this:
do_action("${new_status}_$post->post_type", $post->ID, $post);

This is hooked by these:
add_action('future_post', '_future_post_hook', 5, 2);
add_action('future_page', '_future_post_hook', 5, 2);

Which then calls this:
function _future_post_hook($deprecated = '', $post) {
	wp_clear_scheduled_hook( 'publish_future_post', $post->ID );
	wp_schedule_single_event(strtotime($post->post_date_gmt. ' GMT'),
'publish_future_post', array($post->ID));
}

And there you go.


More information about the wp-hackers mailing list