How to Disable WordPress Cron
WordPress has a built-in cron system that runs on page loads, which can cause performance issues. For better reliability and performance, you can disable it and use a system cron job instead.
Important: Always backup your site before making changes to core files.
Step-by-Step Instructions
- Connect to your website via FTP or file manager in your hosting control panel
- Locate the
wp-config.phpfile in your WordPress root directory - Edit the file and add the following line above
/* That's all, stop editing! Happy publishing. */:define('DISABLE_WP_CRON', true); - Save the changes and upload the file back to your server
Note: After disabling WP-Cron, you must set up a system cron job to run periodically.
Setting Up System Cron Job
Add one of the following commands to your system's crontab (replace with your actual path):
Using wget (most common):
*/15 * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Using curl:
*/15 * * * * curl https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Using PHP CLI (most efficient):
*/15 * * * * cd /path/to/your/wordpress && php wp-cron.php >/dev/null 2>&1
Path Information
Since your wp-cron.php is in the public_html folder, the path will depend on your server setup.
Common Path Examples:
- cPanel servers:
/home/username/public_html - DirectAdmin servers:
/home/username/domains/domain.com/public_html - Plesk servers:
/var/www/vhosts/domain.com/httpdocs
Path Helper
Enter your website's URL to determine the correct path:
Verification
After setting up your cron job, verify it's working by:
- Checking your server's cron job log
- Creating a test scheduled post in WordPress
- Using a plugin like "WP Crontrol" to monitor cron events
Tip: The frequency of your cron job depends on your needs. For most sites, running every 15 minutes is sufficient.