Optimising WordPress Cron (wp-cron) – Firstserv
WordPress does not use a true system scheduler by default. Instead, it relies on a file called wp-cron.php, which runs scheduled tasks whenever someone visits your website.
While this works for smaller sites, it can become inefficient and resource-intensive on busy or highly optimised websites.
Why Is wp-cron Inefficient?
High-Traffic Websites
On busy sites, wp-cron.php is triggered every time a page is loaded.
For example:
- 100 visitors per hour
- Each views 3 pages
- = 300 executions per hour
- = 7,200 executions per day
This can lead to:
- Increased CPU usage
- High memory consumption
- Multiple overlapping cron processes running simultaneously
- Slower website performance
Low-Traffic or Cached Websites
On quieter or highly cached sites, the opposite can happen:
wp-cron.phpmay not run often enough- Scheduled tasks (e.g. publishing posts, clearing cache) may be delayed
Recommended Solution
To improve performance and reliability, we recommend:
✅ Disable WordPress’s built-in cron system
✅ Replace it with a scheduled cron job via cPanel
This gives you full control over how often tasks run.
Step 1: Disable wp-cron in WordPress
- Log in to cPanel → File Manager
- Locate your WordPress installation directory
- Open the
wp-config.phpfile - Find the following line:
define('WP_DEBUG', false);
(You may see true instead—this is fine.)
- Add the following line directly underneath:
Your configuration should now look similar to:
- Save the file
Step 2: Create a Cron Job in cPanel
Next, set up a scheduled job to replace WordPress’s automatic system.
Command to Use
Replace yourdomain.com with your actual domain name.
Choosing the Right Schedule
The ideal schedule depends on how your site operates:
Run More Frequently (e.g. every 5–15 minutes) if:
- You publish scheduled posts
- You run an e-commerce store
- You rely on frequent updates or integrations
- You experience spam filtering delays
Run Less Frequently (e.g. hourly or daily) if:
- Your site has low activity
- Tasks do not need real-time execution
General Recommendation
- Minimum: Once per day
- Maximum: Once per minute
Benefits of This Approach
Switching to a real cron job provides:
✅ Reduced server load – no unnecessary repeated executions
✅ Improved performance – fewer background processes
✅ Better reliability – tasks run on a predictable schedule
✅ Greater control – you decide how often tasks execute
Final Notes
After setting this up:
- Monitor your website to ensure everything works as expected
- Adjust the schedule if tasks run too slowly or too often
- Check features like scheduled posts, emails, and plugins
Summary
By disabling WordPress’s default cron and replacing it with a cPanel cron job, you can:
- Improve site speed
- Reduce resource usage
- Ensure consistent task execution
If you need help setting up cron jobs or optimising your WordPress performance, the Firstserv support team is always available to assist.
