WordPress uses a file called wp-cron.php to perform scheduled tasks such as:
- Publishing scheduled posts
- Checking for WordPress, plugin, and theme updates
- Sending email notifications
- Running maintenance tasks
- Executing plugin-specific scheduled actions
By default, WordPress triggers wp-cron.php every time someone visits your website.
For low-traffic websites, this approach works well. However, on busy websites, repeated execution of wp-cron.php can increase CPU usage and negatively affect website performance.
A more efficient solution is to disable the built-in WordPress cron system and replace it with a real server-side cron job.
Table of Contents
1. Disable wp-cron.php in WordPress
Connect to your hosting account using FTP or SSH and locate the wp-config.php file in your website’s root directory (usually public_html).
Open the file for editing and add the following line before the comment:
/* That's all, stop editing! Happy publishing. */
Add:
define('DISABLE_WP_CRON', true);
Example:
define('DISABLE_WP_CRON', true);
/* That's all, stop editing! Happy publishing. */
Save the file after making the change.
This prevents WordPress from executing cron tasks whenever a visitor loads a page.
2. Create a CRON Task in Mybox Panel
Log in to your Mybox Panel.
From the left-hand menu, navigate to:
Advanced → CRON Jobs
Click Add Task and configure the task as follows:
Profile
Select:
Every 5 minutes
Program
Select:
Wget
URL
Enter your website address using the following format:
https://yourdomain.com/wp-cron.php?doing_wp_cron
Replace yourdomain.com with your actual domain name.
Example:
https://example.com/wp-cron.php?doing_wp_cron
Interval
Select:
Every 5 minutes
For most websites, a 5-minute interval is sufficient. Websites with very frequent scheduled tasks may require a shorter interval.
Finally, click Add Task to save the cron job.
Benefits of Using a Server-Side CRON
Replacing WordPress’s built-in cron system with a real cron job offers several advantages:
- Reduced server load
- Improved website performance
- More reliable execution of scheduled tasks
- Better scalability for high-traffic websites
- Fewer timeout and resource usage issues
Summary
To optimize WordPress scheduled tasks:
- Disable the built-in WordPress cron system by adding:
define('DISABLE_WP_CRON', true);
to the wp-config.php file.
- Create a server-side CRON task in the Mybox Panel that calls:
https://yourdomain.com/wp-cron.php?doing_wp_cron
every 5 minutes.
This ensures that scheduled WordPress tasks continue to run reliably while reducing the performance impact on your website.