Configuring Optimization Settings for WPForms in Async JavaScript

Are you encountering issues with WPForms due to the Async JavaScript plugin’s optimization settings? While this plugin is great for improving site performance by optimizing JavaScript loading, it can sometimes interfere with WPForms functionality.

This guide will help you adjust Async JavaScript settings to ensure WPForms works correctly.


Async JavaScript

The Async JavaScript plugin is used to optimize a site’s JavaScript by adding either async or defer attributes to JS scripts.

Here is the difference between the async and defer attributes:

  • Async: downloads JavaScript while still parsing HTML, but pauses the HTML parsing to execute the JavaScript.
  • Defer: downloads JavaScript while still parsing HTML, but waits to execute it until after HTML parsing is finished.

If either of these attributes is added, it can cause some WPForms scripts to load differently, resulting in an error.

If your forms aren’t working with Async JavaScript enabled, and you’ve identified a JavaScript issue, please proceed with the following steps:

Deactivating Async JavaScript

The first step is to deactivate the Async JavaScript plugin, then check if the issue is resolved. If deactivating the plugin helped, you can reactivate it, then move on to the next step.

Excluding WPForms Assets

Within the Async JavaScript settings, WPForms assets can be excluded from JavaScript optimization in two different ways: Script Exclusion or Plugin Exclusion. We’ll go over each of these options below:

Script Exclusion

To exclude WPForms scripts from Async JavaScript, you’ll need to navigate to Settings » Async JavaScript.

Async JavaScript Settings

Then, scroll to the Script Exclusion section. In the Scripts to Exclude field, input the following script:

/wp-content/plugins/wpforms/assets/js/frontend/wpforms.min.js

Exclude scripts from Async JavaScript

Once you’ve added the script, be sure to save your settings by clicking the Save Settings button at the bottom of the page.

Save settings Async JavaScript
Plugin Exclusion

To exclude any JavaScript files that are contained within the WPForms plugin, scroll to the Plugin Exclusion section, and click on the Exclusions field. Then, select WPForms.

Plugin exclusions Async JavaScript

Next, click the Save Settings button to save your changes.

Save settings button Async JavaScript

That’s it! Now you know how to adjust Async JavaScript settings to prevent conflicts with WPForms.

Next, would you like to learn more about troubleshooting JavaScript errors in WPForms? Be sure to check out our troubleshooting JavaScript errors guide for more details.

The Best WordPress Drag and Drop Form Builder Plugin

Easy, Fast, and Secure. Join over 6 million website owners who trust WPForms.

Please enable JavaScript in your browser to complete this form.