WordPress.org

Make WordPress Core

Ticket #25773: 25773.diff

File 25773.diff, 634 bytes (added by dd32, 6 years ago)
  • src/wp-includes/cron.php

     
    168168                $args = array_slice( func_get_args(), 1 );
    169169        }
    170170
    171         while ( $timestamp = wp_next_scheduled( $hook, $args ) )
    172                 wp_unschedule_event( $timestamp, $hook, $args );
     171        $crons = _get_cron_array();
     172        if ( empty( $crons ) )
     173                return;
     174        $key = md5( serialize( $args ) );
     175        foreach ( $crons as $timestamp => $cron ) {
     176                if ( isset( $cron[$hook][$key] ) ) {
     177                        wp_unschedule_event( $timestamp, $hook, $args );
     178                }
     179        }
    173180}
    174181
    175182/**