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)
- Log in to cPanel
- Find Cron Jobs under Advanced
- Set the timing to Every 1 Minute (or use
* * * * *) - Enter the command:
wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1Or using curl:
curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1- Click Add New Cron Job
SSH / Linux Server
- Connect to your server via SSH
- Open the crontab editor:
crontab -e- Add this line:
* * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1- Save and exit
Plesk
- Log in to Plesk
- Go to Scheduled Tasks
- Click Add Task
- Set to run every minute
- Enter the wget or curl command above
- 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>&1Step 3: Verify Setup
After setting up the cron job, verify it's working:
Check Scheduled Tasks
- Install the WP Crontrol plugin (optional but helpful)
- Go to Tools > Cron Events
- Verify tasks are running on schedule
Monitor Sync Logs
- Go to SWS Pro > Logs
- Check that sync operations are running consistently
- 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).
Recommended Frequency
| Scenario | Frequency | Cron Expression |
|---|---|---|
| Most sites | Every 1 minute | * * * * * |
| High-volume | Every 1 minute | * * * * * |
| Low resources | Every 5 minutes | */5 * * * * |
Running every minute is recommended for SquareSync to ensure real-time sync operations process promptly.
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: