MervCodes

Tech Reviews From A Programmer

WordPress - Cron job is not working

1 min read

If your WordPress cron job is not firing, you're not alone. WordPress cron (WP-Cron) works differently from a real server cron job, and this difference is the root cause of most issues.

How WP-Cron Works

Unlike a real server cron that runs on a schedule regardless of traffic, WP-Cron only runs when someone visits your site. If your site has low traffic, scheduled tasks like publishing future posts, sending emails, or running backups may be delayed or skipped entirely.

Common Fixes

1. Disable WP-Cron and Use a Real Cron Job

Add this line to your wp-config.php:

define('DISABLE_WP_CRON', true);

Then set up a real server cron job that hits the WP-Cron endpoint:

*/5 * * * * curl -s https://yoursite.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

This runs every 5 minutes, ensuring your scheduled tasks fire on time regardless of traffic.

2. Check for Plugin Conflicts

Some caching or security plugins can interfere with WP-Cron. Temporarily deactivate your plugins one by one to identify if a specific plugin is blocking cron execution.

3. Check Your Hosting

Some hosting providers disable or limit wp-cron.php execution. Contact your host to confirm WP-Cron is not being blocked at the server level. This is especially common on shared hosting plans where providers try to limit server resource usage.