Skip to Content

Adding URLs to the JSON Speculation Rules API

Hook into the Nebula speculationrules JSON script to add more pages to be preloaded.

January 29, 2024

Additional Notes

To add basic URLs you can simply append to the array. For more complex speculative rules, you can copy the metadata.php file to the child theme.

The array starts with the homepage by default, but that can be removed or reset as you like.

add_filter(‘nebula_speculative_preload_pages’, function($urls){
$urls[] = ‘/about-us/’; //Simply add a url to the array
//Add certain pages based on the current page
if ( is_page(1224) ){ //Example product detail page
$urls[] = ‘/products/’;
$urls[] = ‘/where-to-buy/’;
return $urls; //Always return in a filter!


Browser Support:


Please note that Nebula does preload links on hover, which this JSON can also natively support. See the documentation for those details.

Was this page helpful? Yes No

    A feedback message is required to submit this form.

    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!