# Scheduled Cron Events Viewer

> Adds a Tools > Cron Events screen listing every scheduled WP-Cron event with its next run time, recurrence and hook name, to debug missed or duplicate tasks.

- Type: PHP
- Runs: Admin only
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: cron, debugging, tools, scheduling
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/dev-cron-events-viewer/

## Code

```php
add_action( 'admin_menu', function () {
    add_management_page( 'Cron Events', 'Cron Events', 'manage_options', 'wpide-cron-events', function () {
        $crons     = _get_cron_array();
        $schedules = wp_get_schedules();

        echo '<div class="wrap"><h1>Cron Events</h1>';

        if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
            echo '<div class="notice notice-info inline"><p>DISABLE_WP_CRON is set: events only run when a server cron job calls wp-cron.php.</p></div>';
        }

        echo '<table class="widefat striped"><thead><tr><th>Hook</th><th>Next run</th><th>Recurrence</th><th>Arguments</th></tr></thead><tbody>';

        foreach ( (array) $crons as $timestamp => $hooks ) {
            foreach ( (array) $hooks as $hook => $events ) {
                foreach ( (array) $events as $event ) {
                    $when = $timestamp < time() ? 'overdue (' . human_time_diff( $timestamp ) . ')' : 'in ' . human_time_diff( $timestamp );
                    $rec  = $event['schedule'] ? ( isset( $schedules[ $event['schedule'] ] ) ? $schedules[ $event['schedule'] ]['display'] : $event['schedule'] ) : 'once';

                    printf(
                        '<tr><td><code>%1$s</code></td><td>%2$s<br><small>%3$s</small></td><td>%4$s</td><td><code>%5$s</code></td></tr>',
                        esc_html( $hook ),
                        esc_html( $when ),
                        esc_html( wp_date( 'Y-m-d H:i:s', $timestamp ) ),
                        esc_html( $rec ),
                        esc_html( $event['args'] ? wp_json_encode( $event['args'] ) : '' )
                    );
                }
            }
        }

        echo '</tbody></table></div>';
    } );
} );
```

## Notes

Read-only: nothing can be deleted or run from this screen.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Scheduled Cron Events Viewer" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
