Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_upgrade_cron_array() WordPress Function

The upgrade_cron_array() function is used to upgrade the cron array to the new format. The new format is an associative array of arrays with the following keys: 'time', 'schedule', 'args', and 'interval'. The 'time' key is used to store the time when the event should run, the 'schedule' key is used to store the recurrence schedule for the event, the 'args' key is used to store the arguments for the event, and the 'interval' key is used to store the interval for the event.

_upgrade_cron_array( array $cron ) #

Upgrade a Cron info array.


Description

This function upgrades the Cron info array to version 2.


Top ↑

Parameters

$cron

(array)(Required)Cron info array from _get_cron_array().


Top ↑

Return

(array) An upgraded Cron info array.


Top ↑

Source

File: wp-includes/cron.php

function _upgrade_cron_array( $cron ) {
	if ( isset( $cron['version'] ) && 2 == $cron['version'] ) {
		return $cron;
	}

	$new_cron = array();

	foreach ( (array) $cron as $timestamp => $hooks ) {
		foreach ( (array) $hooks as $hook => $args ) {
			$key                                     = md5( serialize( $args['args'] ) );
			$new_cron[ $timestamp ][ $hook ][ $key ] = $args;
		}
	}

	$new_cron['version'] = 2;
	update_option( 'cron', $new_cron );
	return $new_cron;
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.