wpseek.com
WordPress开发者和主题制作者的搜索引擎
_upgrade_cron_array is private and should not be used in themes or plugins directly.
_upgrade_cron_array › WordPress Function
Since2.1.0
已弃用n/a
› _upgrade_cron_array ( $cron )
| 访问: |
|
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Upgrades a cron info array.
This function upgrades the cron info array to version 2.Related Functions: _get_cron_array, _set_cron_array, upgrade_network, do_action_ref_array, rest_is_array
源码
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'] ?? array() ) );
$new_cron[ $timestamp ][ $hook ][ $key ] = $args;
}
}
$new_cron['version'] = 2;
update_option( 'cron', $new_cron, true );
return $new_cron;
}