On this page
_upgrade_cron_array( array $cron ): array
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 a cron info array.
Description
This function upgrades the cron info array to version 2.
Parameters
$cronarray Required-
Cron info array from _get_cron_array() .
Return
array An upgraded cron info array.
Source
File: wp-includes/cron.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| update_option() wp-includes/option.php | Updates the value of an option that was already added. |
Used By
| Used By | Description |
|---|---|
| _get_cron_array() wp-includes/cron.php | Retrieve cron info array option. |
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_upgrade_cron_array