Docs
Server-Side Cron Setup

Server-Side Cron Setup

Set up a real server cron job for reliable background processing.

WordPress's built-in WP-Cron system is unreliable for time-sensitive sync operations. Setting up a server-side cron job ensures your sync queue processes consistently.

Why Server-Side Cron?

The Problem with WP-Cron

WP-Cron only runs when someone visits your site. This creates issues:

  • Low-traffic sites — Tasks may not run for hours
  • Missed schedules — Sync jobs can pile up
  • Inconsistent timing — No guarantee when tasks execute
  • Stalled queues — Processing stops when no visitors arrive

The Solution

A server-side cron job runs on a fixed schedule regardless of site traffic, ensuring:

  • Consistent task execution
  • Reliable queue processing
  • Predictable sync timing
  • No dependency on visitors

Step 1: Disable WP-Cron

First, disable WordPress's built-in cron to prevent duplicate execution.

Add this line to your wp-config.php file (before "That's all, stop editing!"):

define('DISABLE_WP_CRON', true);

Step 2: Set Up Server Cron

Choose the method that matches your hosting environment.

cPanel (Most Shared Hosting)

  1. Log in to cPanel
  2. Find Cron Jobs under Advanced
  3. Set the timing to Every 1 Minute (or use * * * * *)
  4. Enter the command:
wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Or using curl:

curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  1. Click Add New Cron Job

SSH / Linux Server

  1. Connect to your server via SSH
  2. Open the crontab editor:
crontab -e
  1. Add this line:
* * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  1. Save and exit

Plesk

  1. Log in to Plesk
  2. Go to Scheduled Tasks
  3. Click Add Task
  4. Set to run every minute
  5. Enter the wget or curl command above
  6. Save the task

WP-CLI (Advanced)

If WP-CLI is available, you can use:

* * * * * cd /path/to/wordpress && wp cron event run --due-now >/dev/null 2>&1

Step 3: Verify Setup

After setting up the cron job, verify it's working:

Check Scheduled Tasks

  1. Install the WP Crontrol plugin (optional but helpful)
  2. Go to Tools > Cron Events
  3. Verify tasks are running on schedule

Monitor Sync Logs

  1. Go to SWS Pro > Logs
  2. Check that sync operations are running consistently
  3. Look for regular timestamps indicating scheduled execution

Test the Cron URL

Visit your cron URL directly in a browser:

https://yourdomain.com/wp-cron.php?doing_wp_cron

You should see a blank page (no errors).

ScenarioFrequencyCron Expression
Most sitesEvery 1 minute* * * * *
High-volumeEvery 1 minute* * * * *
Low resourcesEvery 5 minutes*/5 * * * *

Common Issues

Cron not running

  • Verify the URL is correct (check for typos)
  • Ensure your site is accessible externally
  • Check if SSL certificate is valid
  • Review server error logs

401/403 errors

  • Some security plugins block wp-cron.php
  • Add an exception for wp-cron.php in your security plugin
  • Check .htaccess for blocking rules

Timeout errors

  • Your cron jobs may be taking too long
  • Enable performance settings to reduce load
  • Consider increasing PHP max_execution_time

Troubleshooting

If sync issues persist after setting up server-side cron: