Skip to content

Cron & Scheduled Tasks Setup

WordPress by default uses “WP-Cron”, a virtual pseudo-cron that only triggers when someone visits your website. If traffic is low or pages are aggressively cached, scheduled tasks (such as countdown closings and ticket hold releases) may be delayed.

Section titled “Recommended: Disable WP-Cron & Configure Server Crontab”

Add this line to your wp-config.php file, just before /* That's all, stop editing! Happy publishing. */:

define( 'DISABLE_WP_CRON', true );

Step 2: Add Real Server Cron (Every Minute)

Section titled “Step 2: Add Real Server Cron (Every Minute)”

Log into your hosting control panel (cPanel, Plesk, Cloudways, CyberPanel) or connect via SSH, and add a cron job running every 1 minute:

Terminal window
* * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Terminal window
* * * * * curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Option C: Using WP-CLI (Fastest & Most Reliable)

Section titled “Option C: Using WP-CLI (Fastest & Most Reliable)”
Terminal window
* * * * * /usr/local/bin/wp cron event run --due-now --path=/var/www/html >/dev/null 2>&1

Option D: Third-Party Webcron (EasyCron / Cron-Job.org)

Section titled “Option D: Third-Party Webcron (EasyCron / Cron-Job.org)”

If your shared hosting provider does not provide access to crontab or SSH:

  1. Sign up for an external webcron service such as EasyCron or cron-job.org.
  2. Create a new cron job with the URL:
    https://yourdomain.com/wp-cron.php?doing_wp_cron
  3. Set the execution interval to Every 1 minute (or every 5 minutes depending on your plan).
  4. Set HTTP Method to GET.

Section titled “Direct Plugin Cron Endpoints (Recommended)”

In addition to the standard WordPress cron, Quantum Competitions provides two dedicated direct endpoints that bypass pseudo-cron scheduling entirely for sub-minute accuracy:

1. Finished Competition Checker (?competition-cron=check)

Section titled “1. Finished Competition Checker (?competition-cron=check)”

Executes simple_lottery_cron() to evaluate closing dates and draw winners:

Terminal window
* * * * * wget -q -O - "https://yourdomain.com/?competition-cron=check" >/dev/null 2>&1
  • Internal Loop: Runs 3 cycles per execution with 20-second sleep intervals, ensuring closing accuracy within 20 seconds.
  • Auto-Dismiss: Pinging this URL automatically clears the admin dashboard setup warning.

2. Automated Relister (?competition-relist=true)

Section titled “2. Automated Relister (?competition-relist=true)”

Executes qcw_pn_cron() to republish expired competitions configured with automatic relisting:

Terminal window
0 * * * * wget -q -O - "https://yourdomain.com/?competition-relist=true" >/dev/null 2>&1

Navigate to Competitions > Settings > Tools to view the status of registered cron events:

  • qcw_check_ended_competitions: Scans for competitions whose end date has passed.
  • qcw_cleanup_cart_reservations: Releases unpurchased ticket reservations whose hold time expired.
  • In WP Admin header notices, check whether the cron notice has cleared.