Exclude JS in W3speedster
November 9, 2024 ยท AI Conversations
### Method 1: Use the "Exclude Scripts" option in W3speedster settings
1. **Log in to your WordPress admin dashboard**.
2. Go to **W3speedster > Settings**.
3. Find the section called **"Exclude Scripts"** or **"Exclude JS"** (the wording may vary based on the plugin version).
4. In the **"Exclude JS"** field, add the following path:
Divi/js/custom.js
5. Save the changes and **clear the cache**.
### Method 2: Use a Full Path Exclusion (if needed)
If adding just the filename does not work, you might need to specify the full path:
1. In the **Exclude JS** field, enter the full URL, like:
https://yourwebsite.com/wp-content/themes/Divi/js/custom.js
– Replace `https://yourwebsite.com` with your actual domain.
2. Save the settings and **clear the cache**.
### Method 3: Use Wildcard for Excluding Multiple JS Files (if applicable)
If you want to exclude multiple JavaScript files from the same directory:
1. Add a wildcard pattern:
Divi/js/*.js
2. This will exclude all `.js` files in the `Divi/js/` directory.
3. Save changes and **clear the cache**.
### Method 4: Use the W3speedster Filters (Advanced)
If you have access to the theme's `functions.php` or a custom plugin, you can add a filter to exclude the script:
add_filter('w3speedster_exclude_js', function($excluded_js){
$excluded_js[] = 'Divi/js/custom.js';
return $excluded_js;
});
### Additional Steps
– After excluding the script, **clear all caches** in W3speedster.
– **Test your site** to ensure everything works correctly.
– You may also want to **disable browser caching** temporarily during testing to see the latest changes.
These steps should help you exclude `Divi/js/custom.js` from JavaScript optimization in W3speedster. Let me know if you run into any issues!