Advertisements

wp_cron

Definition:
function wp_cron() {}

Run scheduled callbacks or spawn cron for all scheduled events.

Return values

returns:When doesn’t need to run Cron.

Source code

function wp_cron() {



	// Prevent infinite loops caused by lack of wp-cron.php

	if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) )

		return;



	if ( false === $crons = _get_cron_array() )

		return;



	$local_time = time();

	$keys = array_keys( $crons );

	if ( isset($keys[0]) && $keys[0] > $local_time )

		return;



	$schedules = wp_get_schedules();

	foreach ( $crons as $timestamp => $cronhooks ) {

		if ( $timestamp > $local_time ) break;

		foreach ( (array) $cronhooks as $hook => $args ) {

			if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )

				continue;

			spawn_cron( $local_time );

			break 2;

		}

	}

}

3523

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: