How does cron work in WordPress?
On a server, cron runs commands on a schedule described by a five-field expression: minute, hour, day of month, month and day of week. */15 * * * * means “every 15 minutes”, 0 3 * * 1-5 means “03:00 on weekdays”. Fields accept lists (1,15), ranges (9-17), steps (*/5), month and weekday names, and shortcuts such as @daily.
WordPress has its own scheduler, WP-Cron, which plugins use for publishing scheduled posts, checking for updates, sending emails and clean-up tasks. It is not a real cron: on each page load WordPress checks whether an event is due and, if so, fires a background request to wp-cron.php. On low-traffic sites events run late; on busy sites the check adds overhead to every request. The standard fix is to set DISABLE_WP_CRON and let a server cron job call WP-Cron every few minutes.
This tool covers both sides: a cron expression builder with a validator, plain-English description and the next five run times; the exact crontab lines (wget, curl or WP-CLI) to run WP-Cron reliably; and a generator for the PHP that schedules your own recurring event with wp_schedule_event(), including custom intervals via the cron_schedules filter.
How to use the WordPress Cron Expression Generator
- In Cron expression & server cron, pick a preset or type an expression; edit individual fields if you prefer. The description and next run times update as you type.
- Enter your site URL and WordPress path to get the crontab lines, add
DISABLE_WP_CRONtowp-config.phpand add one of the lines withcrontab -eor your hosting panel. - Switch to WP-Cron PHP event to schedule your own task: name the hook and callback, choose a recurrence or a custom interval and when the first run should happen.
- Choose plugin mode (activation/deactivation hooks) or theme mode (scheduled on
init, cleared on theme switch), copy the PHP and test it withwp cron event run.
Example
Running WP-Cron every 5 minutes from the server instead of on page loads:
# wp-config.php
define( 'DISABLE_WP_CRON', true );
# crontab -e
*/5 * * * * wget -q -O - "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1Cron syntax cheat sheet
*— every value;*/n— every n-th value (*/10in the minute field = every 10 minutes).a-b— a range;a-b/n— every n-th value in the range;a/n— from a to the maximum, every n.a,b,c— a list, e.g.0,30for on the hour and half past.- Day of week: 0 or 7 is Sunday; names
SUN–SATand monthsJAN–DECare accepted. - When both day-of-month and day-of-week are restricted, cron runs when either matches:
0 0 1 * 1runs on the 1st and on every Monday.
WP-Cron best practices
- Always check
wp_next_scheduled()beforewp_schedule_event(), or you will add a duplicate event on every page load. - Clear your events with
wp_clear_scheduled_hook()on deactivation so orphaned events do not run forever. - Keep callbacks short or process work in batches — long tasks hit PHP time limits. For heavy queues, consider Action Scheduler.
- Need to convert a run time? The Unix Timestamp Converter turns
wp cron event listtimestamps into dates.
Frequently Asked Questions
Is it safe to disable WP-Cron?
Yes, as long as a server cron job calls it instead. DISABLE_WP_CRON only stops the check on page loads; events still run whenever wp-cron.php is requested or wp cron event run --due-now is executed. Without a replacement, scheduled posts and updates stop working.
Should I use wget, curl or WP-CLI?
WP-CLI is the most robust: it runs PHP directly, so there is no HTTP request, no web server timeout and no issue with caching or firewalls. Use wget or curl when WP-CLI is not installed, which is common on shared hosting.
How often should the server cron run?
Every 5 minutes suits most sites; every 15 minutes is fine for brochure sites. WP-Cron cannot run events more often than the server job triggers it, so use a shorter interval if you schedule frequent custom events.
Why does my scheduled event never run?
Common causes: the event was scheduled in an activation hook that never ran (code added to an active plugin), a custom schedule name that is not registered, DISABLE_WP_CRON set without a server cron, or a loopback request blocked by the host. wp cron event list and wp cron test show which.
Are cron times in UTC?
Server cron uses the server’s time zone, which is often UTC. WP-Cron stores timestamps in UTC; the generated PHP uses wp_timezone() so a “03:00” first run follows the time zone set in Settings → General.