diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php index 39b61ae35603e..9b7ffbf709694 100644 --- a/src/wp-includes/cron.php +++ b/src/wp-includes/cron.php @@ -507,7 +507,7 @@ function wp_unschedule_event( $timestamp, $hook, $args = array(), $wp_error = fa return $pre; } - $crons = _get_cron_array(); + $crons = _get_cron_array( true ); $key = md5( serialize( $args ) ); unset( $crons[ $timestamp ][ $hook ][ $key ] ); @@ -1223,9 +1223,14 @@ function wp_get_ready_cron_jobs() { * @since 6.1.0 Return type modified to consistently return an array. * @access private * + * @param bool $fresh whether a non-cached version is required * @return array[] Array of cron events. */ -function _get_cron_array() { +function _get_cron_array( $fresh = false ) { + if ( $fresh ) { + wp_cache_delete( 'alloptions', 'options' ); // there doesn't seem to be a more surgical way + } + $cron = get_option( 'cron' ); if ( ! is_array( $cron ) ) { return array();