defined( 'DISABLE_WP_CRON' ) && (bool) DISABLE_WP_CRON, 'scheduled_event_count' => null, 'next_scheduled_timestamp' => null, ); // Read the current WordPress cron option without upgrading, running or changing it. // Export only counts/timestamps, never hook names, arguments or event payloads. $cron = get_option( 'cron', array() ); if ( is_array( $cron ) && ( $cron === array() || ( $cron['version'] ?? null ) === 2 ) ) { $metadata['scheduled_event_count'] = 0; foreach ( $cron as $timestamp => $hooks ) { if ( ! ctype_digit( (string) $timestamp ) || ! is_array( $hooks ) ) { continue; } foreach ( $hooks as $events ) { if ( ! is_array( $events ) ) { continue; } foreach ( $events as $event ) { if ( ! is_array( $event ) || ! array_key_exists( 'schedule', $event ) || ! isset( $event['args'] ) || ! is_array( $event['args'] ) ) { continue; } ++$metadata['scheduled_event_count']; if ( $metadata['next_scheduled_timestamp'] === null || (int) $timestamp < $metadata['next_scheduled_timestamp'] ) { $metadata['next_scheduled_timestamp'] = (int) $timestamp; } } } } } return array( 'nodes' => array( new Node( 'system:cron', 'cron', 'system', 'WP-Cron', 'unknown', 0, $metadata ) ), 'edges' => array() ); } }