Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/wp-includes/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,17 @@ function spawn_cron( $gmt_time = 0 ) {
* @since 2.1.0
* @since 5.1.0 Return value added to indicate success or failure.
* @since 5.7.0 Functionality moved to _wp_cron() to which this becomes a wrapper.
* @since 6.9.0 The _wp_cron() callback is moved from {@see 'wp_loaded'} to the {@see 'shutdown'} action; the function always returns void.
* @since 6.9.0 The _wp_cron() callback is moved from {@see 'wp_loaded'} to the {@see 'shutdown'} action,
* unless `ALTERNATE_WP_CRON` is enabled; the function now always returns void.
*/
function wp_cron(): void {
if ( doing_action( 'shutdown' ) ) {
if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
if ( did_action( 'wp_loaded' ) ) {
_wp_cron();
} else {
add_action( 'wp_loaded', '_wp_cron', 20 );
}
} elseif ( doing_action( 'shutdown' ) ) {
_wp_cron();
} else {
add_action( 'shutdown', '_wp_cron' );
Expand Down
Loading