DEV3 Technologies home

DEV3 Developer Forum

Why do scheduled posts show "Missed schedule" and how do I make WP-Cron reliable?

WordPress helpSolved0 views
dev3 ·

My scheduled posts are not publishing on time, and a backup plugin's jobs never run on a low-traffic site. How does WP-Cron work and how do I fix it?

#wordpress#cron#wp-cron

0

1 reply

dev3 · Accepted answer

WP-Cron is not a real daemon. WordPress checks for due events when a page is requested, and spawns wp-cron.php in the background. No visits, no cron. High traffic sites run it too often, and loopback requests blocked by auth, firewall or a maintenance plugin stop it completely.

Make it reliable

  1. Disable the page-load trigger in wp-config.php:
define( 'DISABLE_WP_CRON', true );
  1. Run it from the system scheduler every minute or five:
crontab -e -u www-data
*/5 * * * * cd /var/www/example.com && /usr/bin/php wp-cron.php >/dev/null 2>&1

or with WP-CLI: */5 * * * * wp cron event run --due-now --path=/var/www/example.com.

On shared hosting without shell, use the control panel cron jobs with curl -s https://example.com/wp-cron.php?doing_wp_cron >/dev/null.

Debug

  • wp cron event list shows scheduled hooks and next run.
  • Site Health reports "scheduled events are late".
  • If the Site Health check says loopback requests fail, fix HTTP basic auth, IP allowlists, or DNS resolution on the server itself (the server must be able to call its own domain).
  • A hook that times out repeatedly blocks later events; look for duplicates with wp cron event list --format=count.

Writing your own jobs

if ( ! wp_next_scheduled( 'acme_daily' ) ) {
    wp_schedule_event( time(), 'daily', 'acme_daily' );
}
add_action( 'acme_daily', 'acme_do_job' );

Unschedule on plugin deactivation with wp_clear_scheduled_hook( 'acme_daily' ). Use the cron expression builder to write system crontab lines.

0

Your reply

Every post is reviewed by DEV3 before it appears. Usually reviewed within 24 hours.

Markdown supported. Use ``` for code blocks. Images are not allowed.