[wp-hackers] post_status = future and pseudo-cron

Ryan Boren ryan at boren.nu
Thu Feb 9 23:09:39 GMT 2006

Here's a quick brain storm.  I think we have this simply be a queue of 
actions with timestamps.

wp_schedule_event($timestamp, $action) {
	global $wp_event_queue;
	$args = array_slice(func_get_args(), 2);
	push event on to $wp_event_queue, maybe sort by timestamp.


wp_schedule_event($in_a_future_age, 'publish_future_post', $post_ID);

wp_cron() would be called from somewhere.  It would do a quick timestamp 
quick to see if it is scheduled to run.  If so, it will loop through the 
event queue looking for events that are due.  It will issue a 
do_action() for every event whose time is up.

do_action('publish_future_post', $post_ID);
wp_remove_event('publish_future_post', $post_ID);

In default-filters.php would be this:

add_action('publish_future_post', 'wp_publish_post', $post_ID);

wp_publish_post() would set the post_status to publish and make sure 
pingbacks and such are issued.


More information about the wp-hackers mailing list