Real Cron for WordPress: Replace WP-Cron Safely (5 Minutes)
Author
John CavilWordPress uses a “pseudo cron” (WP-Cron) that only runs when someone visits your site. That means missed tasks on low-traffic sites and random slowdowns on busy ones (orders, emails, backups, cleanups all firing during a page view). The fix: disable WP-Cron and trigger a real server cron on a schedule.
Result: more reliable tasks and snappier pages—especially for WooCommerce orders, subscription renewals, backups, and cache jobs.
Why switch to a real cron?
- Reliability: tasks run on time even without visitors.
- Speed: no surprise “cron spike” during a user request.
- Control: choose the exact frequency (e.g., every 5 minutes).
- Stability: fewer timeouts for big jobs (exports, syncs, emails).
60-second setup in pPanel (Pofii Panel)
If you’re on Pofii: pPanel → List Websites → Manage → Cron Jobs. Paste one command, save.
Don’t want to touch it? Support will add it for you for free.
Recommended command (CLI, fastest & most reliable):
*/5 * * * * cd /home/ACCOUNT/public_html && /usr/local/bin/wp cron event run --due-now --path=/home/ACCOUNT/public_html > /dev/null 2>&1
- Runs due tasks every 5 minutes using WP-CLI (no HTTP request, no cache/CDN issues).
- Replace
/home/ACCOUNT/public_htmlwith your site path (for subfolders, point to that folder).
If WP-CLI isn’t available, use PHP:
*/5 * * * * /usr/bin/php -q /home/ACCOUNT/public_html/wp-cron.php > /dev/null 2>&1
Fallback (HTTP call), least preferred:
*/5 * * * * curl -s https://example.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
Use this only if CLI/PHP path access is not possible.
Step-by-step (any host)
1) Disable the built-in WP-Cron
Add to wp-config.php (above “That’s all, stop editing!”):
define('DISABLE_WP_CRON', true);
This stops WordPress from spawning cron on page views (prevents double-runs).
2) Add a real cron job (choose one)
A) WP-CLI (best):
*/5 * * * * cd /path/to/site && wp cron event run --due-now --path=/path/to/site > /dev/null 2>&1
B) PHP (good):
*/5 * * * * /usr/bin/php -q /path/to/site/wp-cron.php > /dev/null 2>&1
C) HTTP (ok as last resort):
*/5 * * * * curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
Frequency guide: every 5 minutes fits most sites. High-volume stores can use every 1–2 minutes. Small blogs can use every 10–15 minutes.
3) Test it
- In WP admin, install a light tool (e.g., “WP Crontrol”) or use WP-CLI:
wp cron event listThen wait for the next run and confirm due events are processed. - WooCommerce: Tools → Scheduled Actions (Action Scheduler). “Pending” items should clear at the next cron tick.
Troubleshooting (quick fixes)
- Cron runs twice → You forgot
DISABLE_WP_CRON. Add it towp-config.php. - Nothing runs → Path is wrong or PHP/WP-CLI not found. Try:
which php which wpUpdate cron with those paths. - HTTP cron blocked → Cache/CDN/firewall may block
wp-cron.php. Prefer WP-CLI or PHP method. - Big queues (backlog) → Temporarily increase frequency (every 1 min) until it clears; then return to 5 min.
- Multisite → Point cron at the network’s root path; WP-CLI will process due events network-wide.
Safe rollback
- Remove the server cron job.
- Set in wp-config.php:
define('DISABLE_WP_CRON', false); - Save. WP-Cron resumes as before.
Pair with these for best results
- Page cache (LiteSpeed Cache) → lower TTFB
LiteSpeed Cache: Safe Defaults - Object cache (Redis) → faster admin & searches
Redis vs Memcached Setup Guide - Cut noisy AJAX on every page
WooCommerce Cart Fragments Fix - Plan migrations with zero downtime
DNS TTL Playbook - Harden login endpoints & XML-RPC
Security Hardening
Minimal checklist (2 minutes)
DISABLE_WP_CRONset to true inwp-config.php- Real cron added (WP-CLI or PHP) at /5*
- WooCommerce Scheduled Actions clear on time
- No duplicate runs; no HTTP blocks
- Document the cron in your ops notes
FAQ
How often should I run it?
Most sites: every 5 minutes. Heavy-order Woo sites: 1–2 minutes.
Is WP-CLI required?
No, but it’s the cleanest method. PHP cron is fine; HTTP is a fallback.
Will this fix failed emails?
It prevents missed email jobs. For inbox placement, set up SMTP/API with SPF/DKIM/DMARC (see the WordPress SMTP guide).
Final word
Moving from WP-Cron to a real cron is a five-minute, low-risk upgrade that makes WordPress more reliable and keeps users off the hook for background work. If you’re on Pofii, it’s literally a one-field cron in pPanel (List Websites → Manage → Cron Jobs)—or ping support and we’ll set it up for you. Then enjoy steadier orders, emails, and backups without surprise slowdowns.
Leave a Comment