File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -984,10 +984,17 @@ function spawn_cron( $gmt_time = 0 ) {
984984 * @since 2.1.0
985985 * @since 5.1.0 Return value added to indicate success or failure.
986986 * @since 5.7.0 Functionality moved to _wp_cron() to which this becomes a wrapper.
987- * @since 6.9.0 The _wp_cron() callback is moved from {@see 'wp_loaded'} to the {@see 'shutdown'} action; the function always returns void.
987+ * @since 6.9.0 The _wp_cron() callback is moved from {@see 'wp_loaded'} to the {@see 'shutdown'} action,
988+ * unless `ALTERNATE_WP_CRON` is enabled; the function now always returns void.
988989 */
989990function wp_cron (): void {
990- if ( doing_action ( 'shutdown ' ) ) {
991+ if ( defined ( 'ALTERNATE_WP_CRON ' ) && ALTERNATE_WP_CRON ) {
992+ if ( did_action ( 'wp_loaded ' ) ) {
993+ _wp_cron ();
994+ } else {
995+ add_action ( 'wp_loaded ' , '_wp_cron ' , 20 );
996+ }
997+ } elseif ( doing_action ( 'shutdown ' ) ) {
991998 _wp_cron ();
992999 } else {
9931000 add_action ( 'shutdown ' , '_wp_cron ' );
You can’t perform that action at this time.
0 commit comments