JS files to exclude from WP Rocket

I use wp rocket to optimize page speed. it works great with hivepress plugins and theme. but there is one issue with above the fold images slider on the listing page.
When I use delay javascript on wp rocket the images slider on listing page look like this till the user interaction:

Then I try to exclude the script of the images slider and it’s not working and give me an error in consoles.
Do you have a solution for this? is there a specific script for the image slider?

image

Please try removing slashes at the end of the URLs you added to exclude, maybe WP Rocket detects these as folder paths.

I find a solution so if anyone needs he can use it.
This is what should be excluded from js delay:

/wp-includes/js/imagesloaded.min.js
/wp-content/themes/rentalhive/vendor/hivepress/hivetheme/assets/js/frontend.min.js
/wp-content/plugins/hivepress/assets/js/slick.min.js
/wp-includes/js/jquery/jquery.min.js
/wp-content/themes/rentalhive/assets/js/frontend.min.js

And then there is cart-fragment script that remains and gives an error in the console but we don’t need it because we do not use woocommerce cart. so just disable using the following snippet and insert it inside function.php

function sert_dequeue_woocommerce_cart_fragments() { 
	wp_dequeue_script('wc-cart-fragments'); 
}

add_action( 'wp_enqueue_scripts', 'sert_dequeue_woocommerce_cart_fragments', PHP_INT_MAX);

But there is another issue @ihor . on user interaction the google maps is not showing. the problem is not in wp rocket. can you check what cause this issue with google maps?

1 Like

Please make sure that Google Maps are loaded earlier than the hivepress-geolocation/assets/js/common.min.js script, also this issue may occur if all the JS scripts are combined into 1 file, then the API key added to the Google Maps script URL is stripped.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.