StarDomain

WordPress Cron and Scheduled Tasks

WordPress Cron and Scheduled Tasks

WordPress uses a virtual cron system (WP-Cron) for scheduled tasks like publishing, updates, and backups.

How WP-Cron Works

WP-Cron runs on page visits, not at exact times. This means:

  • Tasks run when someone visits your site
  • Low-traffic sites may have delayed cron jobs
  • High-traffic sites may run cron too often

Improving WP-Cron

For reliable scheduling, disable WP-Cron and use a real server cron:

Step 1: Disable WP-Cron

Add to wp-config.php:

php
define('DISABLE_WP_CRON', true);

Step 2: Create Server Cron

In cPanel → Cron Jobs, add:

*/15 * * * * /usr/local/bin/php /home/username/public_html/wp-cron.php > /dev/null 2>&1

This runs WP-Cron every 15 minutes reliably.

Common WP-Cron Tasks

  • Scheduled posts: Publishing at set times
  • Plugin updates: Checking for new versions
  • Backups: UpdraftPlus, BackupBuddy schedules
  • Email digests: Newsletter plugins
  • Cache clearing: Periodic cache purges

Viewing Scheduled Cron Jobs

Install the WP Crontrol plugin to:

  • See all scheduled events
  • Edit cron schedules
  • Add or remove cron jobs
  • Debug failed cron tasks

Troubleshooting

  • Scheduled posts not publishing: Enable real cron (above)
  • Duplicate cron entries: Use WP Crontrol to clean up
  • Cron running too often: Check for plugins adding excessive schedules