Autoptimize and Contact Form 7 Conflicts

WordPress/ 29th Aug 2019/Jamie Hoyles

Autoptimize is a great plugin for WordPress that combines scripts and code to reduce HTTP look ups. This can speed websites up considerably, improving both visitor experience and how Google, Yahoo, etc rank the site. Using Autoptimize and Contact Form 7 on the same WordPress install however can stop a visitor being able to send a message through the site with a “Failed to Send Your Message” message displayed when hitting the submit button.

Autoptimize and Contact Form 7

Similar to how Recaptcha can interfere with Contact Form 7 submissions, Autoptimize and Contact Form 7 can also cause conflicts. This is due to one of the pieces of code the plugin is able to reduce – Javascript.

Fixing Autoptimize and Contact Form 7 Errors

When I encountered Autoptimize and Contact Form 7 conflicts on my own site I did a lot of searching and found a solution of adding the selected code to an exclude list…

Unfortunately this did not work for me so I needed to find another solution. This solution was to exclude the contact page from being optimised… Thankfully it’s fairly straightforward and includes adding a piece of code to the functions.php file – a really simple and good way to do this is using a plugin called Code Snippets…

1
Download Code Snippets

The plugin can be obtained here. Once installed it allows you to add pieces of code to your functions.php file without editing any core files. This is also beneficial as you can continue to update WordPress without any changes being overwritten. It is also easy to manage any snippets that are added.

2
Add Your Snippet

You’ll need to specify the page ID to be excluded. This can be found by navigating to the page that features your content form whilst in WP-admin – it is shown in the URL bar:

Once you have this, add the following code to Code Snippets – replacing ‘test’ with your page ID.

Once activated, Autoptimize will no longer combine scripts on that page and your Contact Form 7 submissions will work as they should.

Did you know…

At Clook, one of our specialisms is providing WordPress hosting, if you’d like to find out more, please get in touch with us.

Office Manager & Customer Account handler at Clook Internet. SEO Enthusiast & WordPress Web Developer in my spare time. Outside work I’m a supporter of Blackburn Rovers, like fast cars and watching fast bikes…

We have a very strong team here at Clook and we build on everyone's strengths and weaknesses, you have to be able to make a good brew too!

Chris James

Customer Login

Forgot Password? Cancel