Preload is slow, or some pages are not preloaded at all

In this article

Preload is slow or doesn't finish

There are 2 possible reasons why WP Rocket’s preload takes a long time, or doesn’t finish:

PHP execution time

The PHP background process for preloading can only run as long as PHP execution time on the server allows. A common default limit for PHP execution time is 30 seconds; that’s the time a PHP script like the preload is allowed to run, before the server decides it’s been running too long and stops it.

Once WP Rocket’s preload process hits the PHP execution time limit, it stops. It will start the next batch of URLs after that. If for some reason the process doesn't restart again automatically, we have a cron that triggers after 5 minutes to restart the process. 

So when there are a lot of URLs to preload, WP Rocket manages to preload  n URLs in 30 seconds, then takes a break for up to 5 minutes, then preloads another n URLs in another 30 seconds, then takes a break, etc., until all URLs have been preloaded.

WP Cron

Preloading relies on  WP Cron, which in turn relies on PHP page loads in WordPress. Those page loads can be back-end, or front-end, but as PHP is not executed on cached pages, for a site with WP Rocket we’re talking about back-end activity mostly.

In a nutshell, if there is no activity on WP Admin for some time, WP Rocket’s preload would stop being triggered.

Tip: Quickly check if WP-Cron can run on your WordPress: WP-Cron Status Checker
After activation, visit your Dashboard and look for the WP-Cron Status Checker widget.

To make preloading more reliable, it's recommended to replace wp-cron with a real cron job from your server. Here's an example of how to do that: 
https://www.siteground.com/tutorials/wordpress/setup-cron-job.htm

Set the cron job to 5 minutes.

Alternatively, if you want to control the exact time at which the cache is cleared and preloaded,  you can set up a custom cron, as described here:
How to clear cache via cron job

Troubleshooting preload error notices

There are several reasons why preload may not be working. WP Rocket will display an error notice when it is not possible to reach your homepage or sitemap URL(s). Below are troubleshooting tips to help resolve the issue.

Homepage or Sitemap is not accessible

Common errors: 401, 403, 404, 500

  • Check your homepage or sitemap URL(s) in a browser to make sure it displays. If not, check directly on your site or with your host regarding site access.
  • Check that your sitemap URL(s) is entered correctly on the Preload tab.
  • Check security measures (plugin or firewall) to make sure access to your site is not blocked. Whitelisting your site’s IP address or the preload user agents WP Rocket/Partial_Preload, WP Rocket/Preload, WP Rocket/Sitemaps may help.
  • Preload cannot reach sites that use htaccess/ htpasswd authorization. Configuring the helper plugin below may allow preload to bypass this setup:
  • Heads up! Manual code edit required before use!
    1) Set WPROCKETHELPERS_HTACCESS_USERNAME as your .htaccess username and WPROCKETHELPERS_HTACCESS_PASSWORD as your .htaccess password.
    2) wp-cron.php needs to be whitelisted. You can add this directive to your .htaccess file to accomplish this.

    📥  Download (.zip): WP Rocket | HTACCESS Authorization For Preload
    Developers: You can find the code for this plugin on GitHub.

Slow Server response time

Common error: cURL error 28

When a preload is initiated, our crawler attempts to access your homepage or sitemap. It waits for 10 seconds and if there is no response it stops and nothing will be preloaded. 

To see if this could be the case on your site you can test the response time of your server. This is done with a cURL command (using an application like Terminal for Mac, or cmd.exe for Windows). Enter the following command, and don't forget to replace http://example.com/sitemap.xml with your own sitemap URL, homepage URL, or whichever URL is referenced in the error messages you see. 

curl -o /dev/null -s -w %{time_total}\\n  http://example.com/sitemap.xml

If the response time of the URL is more than 10 seconds, first try increasing the PHP memory for your site.

If that doesn't help, you can increase the timeout for the preload request by using the helper plugin below.

📥  Download (.zip): WP Rocket | Custom cURL Timeout For Preload Request
Developers: You can find the code for this plugin on GitHub.

SSL Certificate configuration

Common error: cURL error 60

When preload makes a request to retrieve your URL(s), it can be blocked by a misconfiguration of the site’s SSL certificate. Please contact your host to identify and resolve the issue. Temporarily, you can use this helper plugin to allow preload to bypass validation:

📥  Download (.zip): WP Rocket | Disable SSL Certificate Validation
Developers: You can find the code for this plugin on GitHub.

Server configuration

Common error: cURL error 7

There might be problems connecting with your site due to a misconfiguration on the server. Contact your host to identify and resolve the issue.

Tip: When WP Rocket detects a sitemap preload cURL error, this triggers an automatic fetch and preload of the first 1000 URLs on the failed sitemap.

Empty Sitemap

Your sitemap may not have entries present. Check the sitemap URL in your browser or file directly.

SimpleXML PHP extenstion is not enabled

The SimpleXML PHP extension needs to be enabled on your server to use sitemap-based preloading. Contact your host to enable it.

Need to stop a preload in progress?

After a preload has been triggered, a notice will be displayed at the top of your screen. It contains a “Stop Preload” button if you want to halt the process:  

If you think that the preload cache feature is not working on your site, first check to see whether or not cache files are being generated after you click the Preload button.

How To Check if Cache Files are Created

Using either the File Manager in your cPanel, or an FTP client, navigate to the following folder:

wp-content/cache/wp-rocket

Within the wp-rocket folder you should then see a sub-folder named after your domain, e.g.:  example.com

Inside that folder you will see any existing cache files.

Now click the Preload Cache link in the WP Rocket admin toolbar menu. Wait a few moments then refresh the cache folder in your file manager. You should see new files added. You can check the date to see when they were created.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.