Show the next WP-Cron event on the WordPress dashboard
Show an administrator the next scheduled WP-Cron event. The Name Day Coupons example reads the schedule without running or changing it.
This snippet shows the next scheduled time for one WP-Cron event on the WordPress dashboard. The example watches mm_meniny_daily_event, used without arguments by Name Day Coupons for WooCommerce 1.2.2. Only a user with manage_options, normally an administrator, sees it.
The displayed timestamp confirms a scheduled record. It does not confirm the last successful execution, future punctuality or email delivery.
PHP code
On a test copy, add the example to a PHP snippet enabled for administration or set to run everywhere. You can also use a child theme's functions.php. The opening <?php tag is omitted. Enable only one language version.
add_action( 'admin_notices', function () {
if ( ! current_user_can( 'manage_options' ) ) { return; }
$screen = get_current_screen();
if ( ! $screen || 'dashboard' !== $screen->id ) { return; }
$hook = 'mm_meniny_daily_event';
$args = array();
$next = wp_next_scheduled( $hook, $args );
if ( false === $next ) {
$message = 'No scheduled event was found for this hook and arguments.';
} else {
$message = 'Next scheduled time: ' . wp_date( 'Y-m-d H:i:s T', $next );
if ( $next <= time() ) {
$message .= ' This time has passed; check whether the task ran.';
}
}
$disabled = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON;
$message .= ' DISABLE_WP_CRON: ' . ( $disabled ? 'true' : 'false' );
echo '<div class="notice notice-info"><p><strong>' . esc_html( 'WP-Cron: ' . $hook ) . '</strong> ' . esc_html( $message ) . '</p></div>';
} );
Reading the result
Open Dashboard → Home. The timestamp uses the site's time zone. DISABLE_WP_CRON: true reports that the constant is enabled; this alone does not establish whether external scheduling is correctly configured on the host.
If no record is found, check that the plugin is active and the hook is exact. To inspect another event, change both $hook and $args. Arguments must match the scheduled event, including values and types. Order-related events may contain order and rule IDs, so an empty argument list will not locate that specific record.
Checks and scope
Check a future event, an absent record and a past-due time. Sign in as a user without manage_options and verify that the notice is hidden. A default shop manager does not see it either. It is absent from other administration screens and customer pages.
The snippet reads WP-Cron only. It does not inspect Action Scheduler, run jobs or repair scheduling. Do not delete a live event or trigger bulk emails merely to test the notice. The scenarios were checked on WordPress 7.1.5 and PHP 8.4.23. Disable the snippet after diagnosis; scheduled events remain unchanged.
For delayed messages, continue with the WP-Cron and email checks. Coupon configuration is covered by Name Day Coupons. wp_next_scheduled documentation