Skip to main content

WordPress Cron & Scheduled Tasks

Appointment reminders, follow-ups, and auto-complete depend on scheduled tasks. WordPress pseudo-cron only runs when someone visits your site — use a real server cron job on production.

Before you begin

How it works

WooCommerce Appointments uses ActionScheduler (WooCommerce’s task queue) for time-sensitive jobs. ActionScheduler still needs something to trigger wp-cron.php on a schedule.

Why it matters

Low-traffic sites can miss reminder emails if cron never fires. See Email issues if reminders stop.

You are ready when

  1. ✅ A server cron hits wp-cron.php every 1–5 minutes (or DISABLE_WP_CRON + real cron)
  2. Tools → Scheduled Actions shows wc-appointment-reminder tasks for test appointments
  3. ✅ Test reminder email arrives at the configured time

Scheduled tasks in Appointments

TaskWhenConfigure
Appointment reminderBefore startWooCommerce → Settings → Emails → Appointment Reminder
Appointment follow-upAfter endWooCommerce → Settings → Emails → Appointment Follow-up
Auto-completeAt appointment endAutomatic
Daily cleanupOnce per dayRemoves stale in-cart rows, expired rules
Inactive cart removalAfter cart hold periodAutomatic

Action names include wc-appointment-reminder, wc-appointment-follow-up, woocommerce_appointments_daily_cleanup.

WordPress cron vs real cron

Default (pseudo-cron): each page load checks due tasks — unreliable on quiet sites.

Recommended: system cron calls wp-cron.php on a fixed interval.

Server cron (cPanel / shared hosting)

Cron Jobs → every minute (* * * * *):

/usr/bin/php -q /path/to/your/site/wp-cron.php

Or:

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

Replace the path with your site root (often /home/username/public_html/wp-cron.php).

VPS / Linux

crontab -e

Add:

* * * * * /usr/bin/php -q /path/to/your/site/wp-cron.php

Disable pseudo-cron (optional)

When a real cron job is in place, add to wp-config.php:

define( 'DISABLE_WP_CRON', true );
warning

Only set DISABLE_WP_CRON if a server cron job is already running. Otherwise scheduled tasks never execute.

Verify cron is working

  1. Tools → Scheduled Actions — look for wc-appointment-reminder and related hooks
  2. WP Crontrol (optional) — confirm action_scheduler_run_queue runs regularly
  3. Create a test appointment tomorrow; set reminder to 1 hour before; confirm email delivery

Troubleshooting

SymptomFix
Reminders not sendingEnable real cron; check email settings; inspect Scheduled Actions
Tasks lateLow traffic — add server cron
Duplicate runsBoth pseudo-cron and server cron active — use DISABLE_WP_CRON with real cron only

Monitoring plugins (WP Crontrol, Action Scheduler UI) help inspect tasks but do not replace a real cron job.