Follow

Troubleshooting high wp-cron usage

  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access, File Manager, FTP, or SSH access
  • Applies to: DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Plesk/cPanel access, File Manager, FTP, or SSH access
  • Applies to: WordPress Hosting
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: SFTP, or SSH Access

Overview

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.

Before Starting

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.

  1. Navigate to your websites root directory.root directory.
  2. Open/edit your site's wp-config.php file.

    cron-01.png

  3. Locate the line that says: “That’s all, step editing! Happy blogging.” Before that line, insert the following code:
    define('DISABLE_WP_CRON', 'true');
    wp-config.php:
    cron-02.png
  4. Great! The default wp-cron settings are now disabled.

Scheduling wp-cron

  1. 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

  2. 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_cron
    In this example we've set the cron to run every 15 minutes.

    g-1.png

    PLESK:

    p-1.png

    CPANEL:

    cp-2.png
  3. 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.
  4. That's it! You have now edited wp-cron to run more efficiently!

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk