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

This article contains information about the Preload feature being slow or not working.

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.

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: Setting up a real Cron Job.

Self-requests blocked

Check the WordPress Site Health tool for your site by going to  Tools→ Site Health. There you will likely see related errors, like Your site could not complete a loopback request

Some hosts disallow sites hosted on their servers to connect to themselves using cURL. This can prevent WP Rocket features, like Preload and Critical Path to fail.

Please contact your host's support about this and request to remove that limitation if it’s set in the server.

Used CSS generation is in process

When using Preload and Remove Unused CSS, pages will be preloaded only once the Used CSS is generated, to avoid sending an additional request to the server. Therefore, a non-cached page won't be preloaded if its Used CSS is still being generated.

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 security measures (plugin or firewall) to make sure access to your site is not blocked. Allowlisting your site’s IP address or the preload user agent WP Rocket/Preload 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 allowlisted. 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 the preload is initiated, our crawler attempts to access third party sitemaps. If they're not found, WP Rocket will try to use WordPress default sitemap. And if this sitemap is also not found, the Preload will run on the URLs found in the homepage.

If this process times out with a cURL 28 error, the Preload will fail.

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.

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.

How to check if Preload is working

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 Clear and 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.

Preload in WP Rocket versions prior to 3.12

Heads up! The following is obsolete information, which is only relevant to WP Rocket 3.11.5 and older.

Homepage or sitemap is not accessible

  • 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. Allowlisting your site’s IP address or the preload user agents WP Rocket/Partial_PreloadWP Rocket/PreloadWP Rocket/Sitemaps may help

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. 

If the response time of the URL is more than 10 seconds, first try increasing the PHP memory for your site and then use the WP Rocket | Custom cURL Timeout For Preload Request helper as explained above.

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.

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