If your site or server is struggling with high load and you notice many wp-cron.php POST requests in the www logs, then the solution is simple: replace the virtual wp-cron with a real cron at your selected schedule.
WordPress has a file called wp-cron.php that runs every time someone visits your site, which can severely throttle CPU usage and slow down busy sites, as this process only needs to run infrequently. You don’t need to have it running in the background that often, using up valuable hosting resources.
Rather than letting wp-cron slow down your site, it should be disabled and let your system handle scheduled processes in the background — using a cronjob.
Disable wp-cron in WordPress
- Use FTP to access your server and navigate to the public_html folder
- Add this line at the bottom of your wp-config.php file
define(‘DISABLE_WP_CRON’, true);
Enable a real cronjob
You can now schedule these wp-crons to run once every couple of hours instead, using the Cronjob Manager in your cPanel.
- Browse to cPanel
- Select Cronjob Manager
- Select Add
- Next to Name you may give your cronjob a name e.g. wp-cron
- Next to Job enter the following:
/usr/bin/php-wrapper /usr/www/users/ftpuser/wp-cron.php
where ftpuser is your FTP username.
- The Status option allows you to either have the cronjob Enabled or Disabled.
- Under When to execute, set the time(s) when the cronjob needs to execute.
- Select Save.