Aleš Sýkora wrote

WP Rocket + Toolset Exclude files from Defer JS

6. 11. 2019 in

If you use WP Rocket + Toolset (especially Toolset forms) you should exclude deferring some scripts. If you use Forms than it is a must. Without excluding you get some errors in console, like this one:

The scripts are:


For excluding you need small plugin from WP Rocket. You can found it here:

Click on this image to open a GitHub repo of plugin

After downloading and installing this plugin, go to /wp-content/plugins/wp-rocket-static-exclude-defer-js and open wp-rocket-static-exclude-defer-js.php in code editor.

Now you must change the URL /wp-includes/js/jquery/jquery.masonry.min.js to URL of script you want to exclude from defer.

$excluded_files[] = '/wp-includes/js/jquery/jquery.masonry.min.js';

change to: 

$excluded_files[] = '/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/js/validation.js';
$excluded_files[] = '/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/visual-editor/res/js/codemirror/lib/codemirror.js';
$excluded_files[] = '/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/js/conditional.js';
$excluded_files[] = '/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/js/recaptcha-v2/api.js';

Save the file, clear the cache and everything works fine again :-).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Add icon to the menu with custom SVG
2. 4. 2021 in
If you need to add icon to the menu item in WordPress you can find many tutorials using fontawesome, plugins or other icon packs embedded from other sites. For my purposes – loading of more external scripts is not good solution. So when I need to add my custom icon to the menu I do […]
Read More
Aleš Sýkora wrote
Better product gallery lightbox with Oxygen and Fancybox
18. 1. 2021 in ,
I will show you, how I am creating galleries like this (open random car to see it) in Oxygen Builder. I hate the product builder and default behavior of WooCommerce lightbox and magnifying glass function on hover. So I am using Image block wrapped in link – for featured image. And Oxygen’s gallery block for […]
Read More
Aleš Sýkora wrote
Current Year for Copyright in WordPress and Oxygen Builder
Would you like to insert the Copyright information in footer of your website with current year? Use the PHP function Date() with format Y for current year. Normally it looks like: In Oxygen Builder you can use the Dynamic data > PHP function return value, which generates this shortcode:
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram