Add a read-only Tools > Cron Events page that lists every scheduled WP-Cron task, when it runs next and how often.
add_action( 'admin_menu', function (): void {
add_management_page( 'Cron Events', 'Cron Events', 'manage_options', 'nahnu-cron-events', 'nahnu_render_cron_events' );
} );
function nahnu_render_cron_events(): void {
$crons = _get_cron_array() ?: [];
$schedules = wp_get_schedules();
?>
<div class="wrap">
<h1>Cron Events</h1>
<p>Current time: <?php echo esc_html( wp_date( 'Y-m-d H:i:s' ) ); ?>. WP-Cron runs on page visits, so tasks may run a little late.</p>
<table class="widefat striped">
<thead><tr><th>Hook</th><th>Next run</th><th>Schedule</th><th>Arguments</th></tr></thead>
<tbody>
<?php foreach ( $crons as $timestamp => $hooks ) : ?>
<?php foreach ( $hooks as $hook => $events ) : ?>
<?php foreach ( $events as $event ) : ?>
<tr>
<td><code><?php echo esc_html( $hook ); ?></code></td>
<td>
<?php echo esc_html( wp_date( 'Y-m-d H:i:s', $timestamp ) ); ?>
<?php if ( $timestamp < time() ) : ?><strong>(overdue)</strong><?php endif; ?>
</td>
<td><?php echo esc_html( $event['schedule'] ? ( $schedules[ $event['schedule'] ]['display'] ?? $event['schedule'] ) : 'Once' ); ?></td>
<td><code><?php echo esc_html( $event['args'] ? wp_json_encode( $event['args'] ) : '' ); ?></code></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php
}
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
When a scheduled email doesn’t send or a backup doesn’t run, the first question is whether the task is even scheduled. This snippet adds a simple page that answers it, without installing a plugin.
_get_cron_array() returns every scheduled event, grouped by run time and hook name. The page lists each one with its next run time in your site’s time zone, its schedule name from wp_get_schedules() and any arguments.
Events whose time has passed are marked overdue, which usually means WP-Cron isn’t running properly.
DISABLE_WP_CRON is on without a real server cron, or the site gets very little traffic.Go to Tools → Cron Events. You should see core tasks like wp_version_check and wp_scheduled_delete.