The following article provides information on how to troubleshoot high server usage from wp-cron.php. By itself, the wp-cron file has practical applications for your website. It's involved with plugins, scheduling posts, and backup updates.
However, if left unmanaged, the file may eventually start using up unnecessary CPU, memory, and load on your server. By default, the wp-cron file is set to be called on EVERY time someone visits your WordPress when there's a scheduled task present.
Sites do need the wp-cron to be called frequently, but not necessarily every single time a person visits your site. With medium to heavy traffic, this can start to add up and potentially result in slower load times and resource overages. Therefore we will want to disable the default setting, and manually schedule the settings.
STATEMENT OF SUPPORT:
Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.
To perform the instructions below you will need to have access to your files using ONE of the following:
Disabling default wp-cron settings
In this example, we will be using the FTP client, Filezilla.
- Navigate to your websites root directory.root directory.
- Open/edit your site's wp-config.php file.
- Locate the line that says: “That’s all, step editing! Happy blogging.” Before that line, insert the following code:
- Great! The default wp-cron settings are now disabled.
- Next you will want to manually schedule wp-cron. If you'd like a general refresher on how to set up cron jobs on your server, feel free to review the following guide: Using CronUsing Cron
- Insert the following code as your cron job. Be sure to replace example.com with your actual domain name.
wget -q -O - https://example.com/wp-cron.php?doing_wp_cronIn this example we've set the cron to run every 15 minutes.
- The timing you choose for your cron will vary with each site, so be sure to check with your site developer on what would work best for your situation. However, most sites should be fine running wp-cron every 15 minutes or so. If you really need it to run more often, the most frequent we'd recommend is every 5 minutes.
- That's it! You have now edited wp-cron to run more efficiently!