Preload links

The Preload links feature will improve the perceived loading time of pages for a user navigating your site. If a user hovers over, or touches, a link for 100ms or more, the HTML of that page will be fetched in the background, so that when they actually click the link, the page will appear to load nearly instantly!

This option only improves the user experience and perceived load time - you will not notice any difference in your PageSpeed score or loading time as measured by Pingdom, GTmetrix etc.

This optimization is applied on all pages, both cached and uncached, for any visitor  who is not logged in.

Heads up! This feature is supported by Chrome and Chromium-based browsers. Other browsers may support this feature in the future.

In this Article

Preloading links in action

The gif below demonstrates this feature in action:

Automatic exclusions

We automatically exclude some URLs from this feature to prevent unexpected results:

  • Any URL from wp-admin, login/logout
  • URLs excluded from cache by WP Rocket configuration
  • Images
  • Links with a query string or an anchor
  • External URLs
  • Files with PDF, DOC, DOCX and XLS extensions
  • Link slug, as set in the ThirstyAffiliates plugin's Cloaked URL field
  • Links with /refer//go//recommend/ and /recommends/

Manual exclusions

You can manually exclude URLs from this feature using the following filter:

rocket_preload_links_exclusions

You can add a snippet like this to your theme's functions.php file:

add_filter( 'rocket_preload_links_exclusions', function ($links) {
  $links[] = '/projects';
    return  $links;
} );

You can add as many URLs as you want in $links[], to add more exclusions you can add as many lines as you need, one per URL.

Helper plugin

To customize the Preload Links behavior in WP Rocket, you can also use our helper plugin. It lets you:

  • Exclude specific URL patterns from preloading
  • Add image extensions to exclude
  • Add file extensions to exclude

📥   Download (.zip): WP Rocket | Customize Preload Links Configuration
Developers: You can find the code for this plugin on GitHub.

Heads up! The helper plugin doesn't work on its own. Manual code edit is required before use!

Use the README.md file for the specific details about how to apply each customization.

To customize the helper plugin, please:

  1. Download the helper plugin ZIP file and extract it.
  2. Open the wp-rocket-customize-preload-links-config.php file using a text/code editor.
  3. Apply the required customization(s) as per the README.md file.
  4. Save changes.
  5. Compress the helper files into a ZIP file.
  6. On your site - go to Plugins → Add New → Upload plugin, and select the ZIP file.
  7. Activate the plugin.

If you need further help, please contact support.

Plugin compatibility

This feature replaces the need for the following plugins and if they are detected, you will be prompted to deactivate them:

Speculative Loading in WordPress

Speculative Loading in WordPress introduces a similar type of optimization, but it's implemented in a different way and does not conflict with WP Rocket's Preload Links feature.

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