[Resolved] Uncaught ReferenceError: wptValidationForms is not defined

Hi, Amit here, I am the Toolset Support Manager, our current ticket queue is calm and I'd like to encourage you to use our new chat support option

In order to try it out please notice that when you open a ticket (while there's availability) you will be able to choose between chat and a normal ticket, both lanes lead to the same supporters and if we decide in chat that the issue needs more time we'll transform it into a normal email ticket for you, so nothing is lost

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: I am seeing a JavaScript error in the console when I try to use Autoptimize and Async JavaScript plugins to speed up my site.

Solution: Remove validation.js from the list of deferred scripts in both plugins

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 1 year, 8 months ago.

Assigned support staff: Christian Cox.


I am trying to:
Fix the error:
Uncaught ReferenceError: wptValidationForms is not defined

I visited this URL:
hidden link

I expected to see:
No error

Instead, I got:
The error above

The error started appearing when I started optimizing the speed of my website. The two plugins that seems to be causing it is the following:
Async JavaScript - hidden link
Autoptimize - hidden link


Christian Cox

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Hi, it looks like a timing issue where a variable isn't defined yet. Can you try to add the following code to the head of your document:

var wptValidationForms = wptValidationForms || [];

Thanks Christian

Yes I think it might be.

This is probably a stupid question but where would the best place be to add this?


Christian Cox

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Definitely not a stupid question, but I can't say for sure offhand with the implementation of these async, caching and optimization plugins. It all depends on how your site's code is architected, when dependencies like jQuery are loaded, the order in which things are initialized, etc. I would try adding it in Layouts CSS and JS first, to prevent the need to enqueue another script file. If that doesn't resolve the unregistered error consistently across the site, I can investigate further.


Hi Christian

Thanks for the feedback. I managed to resolve the issue by excluding the validation.js script from the scripts to be deferred. There is an option for that on both plugins.



Christian Cox

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Thanks for sharing your solution!