Crontab generator for WordPress cron jobs
Pick how often and how, and copy the three things a real WordPress cron job needs: the wp-config constant, the command that opens the right crontab, and the line to paste into it.
The WordPress address, including a subdirectory if the install lives in one.
Only even divisions of the hour. */7 would fire at :56 and again at :00.
Several sites on one server? Give each a different start so they do not all fire in the same second.
An HTTP request works from any user. Pick the one you can actually edit.
1 — wp-config.php, above “That's all, stop editing”
define( 'DISABLE_WP_CRON', true );
2 — open the crontab
crontab -e 3 — paste this line, save and exit
*/5 * * * * wget -q -O - "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1 4 — check it
# the line is installed crontab -l # cron is firing it (Debian/Ubuntu; on RHEL use: journalctl -u crond) grep CRON /var/log/syslog | tail
Why WordPress needs a real cron job
WP-Cron is not a scheduler. It is a check that runs when somebody loads a page: if an event is due, WordPress fires a
background request at wp-cron.php. No visitors means no check, so on a quiet site a task scheduled for 02:00
runs when the first person shows up at 09:00. On a busy site the opposite happens and the check runs on every request.
A system cron job replaces the visitor with a clock. The constant in step 1 turns the page-load check off; the line in
step 3 calls wp-cron.php on a fixed schedule instead. The failure modes, the Site Health warnings and the
debugging commands are covered in why WP-Cron fails and how to fix it.
No shell access?
Most hosting control panels have a Cron Jobs screen. Choose the interval from their dropdowns and paste only the command — everything after the five schedule fields — into the command box. Step 1 still applies.
If the host offers no cron at all, something outside the server has to make the request. External cron services do that, several of them free. If you run webhooks, the External Cron in Webhook Actions Pro is the managed version: it pings wp-cron.php as often as every 60 seconds, or the plugin's own delivery
queue as often as every 20, writes DISABLE_WP_CRON for you, and shows a heartbeat history in wp-admin.
Three things that break a correct cron line.
- A
%anywhere in it. crontab reads an unescaped percent sign as a newline. This tool refuses URLs that would need one. - A short
PATH. cron does not load your shell profile, sowpandphpare often not found. That is why the WP-CLI option asks for an absolute path. - The wrong user. Every user has a separate crontab. A line added with
sudo crontab -elives in root's, not yours, andcrontab -lwill not show it.
Questions about WordPress cron jobs.
Behaviour described here was checked against wp-cron.php in WordPress 7.1.