Contact Form 7 Not Submitting When WP Rocket Is Active? Here’s How to Fix It
Contact Form 7 and WP Rocket are both widely used WordPress plugins. In most cases they work together without any problem. However, some website owners notice that their contact form stops submitting after WP Rocket is activated or after its file-optimization settings are enabled.
You may see one of these symptoms:
- Clicking the Submit button does nothing.
- The loading spinner continues indefinitely.
- The form displays an unexpected error.
- The form works for logged-in administrators but fails for visitors.
- The form works after clearing the cache but stops again later.
- The form reports success, but no email arrives.
These symptoms can have different causes. Follow the checks below in order so that you can fix the actual conflict without disabling all performance optimization permanently.
Why does Contact Form 7 stop working with WP Rocket?
The most common causes are:
- Contact Form 7 JavaScript is delayed or loaded in the wrong order.
- A cached page contains an expired WordPress nonce.
- Google reCAPTCHA is delayed or blocked.
- The Contact Form 7 REST API request is blocked by a security plugin, CDN or firewall.
- WP Rocket is working alongside another cache layer that continues serving an old page.
- The form submits successfully, but WordPress email delivery is failing.
The first step is to confirm whether WP Rocket is responsible.
1. Test the page without WP Rocket optimization
Open your contact page and add `?nowprocket` to the URL:
https://example.com/contact-us/?nowprocket
WP Rocket provides this query parameter for troubleshooting. It lets you test the page without its frontend optimizations.
Submit the form on this version of the page.
- If the form now works, a WP Rocket optimization setting is causing the conflict.
- If it still fails, investigate Contact Form 7 configuration, the REST API, reCAPTCHA, security rules or email delivery.
2. Check Delay JavaScript Execution
The most common source of the conflict is **Delay JavaScript execution**.
Go to:
WordPress Dashboard → Settings → WP Rocket → File Optimization → JavaScript Files
Temporarily turn off Delay JavaScript execution, clear the WP Rocket cache and test the form in a private browser window.
If the form works, turn the option back on and add these entries to the JavaScript exclusion field:
/contact-form-7/
wpcf7
If Google reCAPTCHA is enabled, you may also need:
recaptcha/api.js
Save the changes, clear the cache and test again. Excluding `/contact-form-7/` is a broad compatibility fix. An experienced developer can inspect the browser console and narrow the exclusion to only the affected script if maximum optimization is required.
3. Test Defer and Minify JavaScript
If disabling delayed JavaScript does not solve the problem, temporarily disable these settings one at a time:
- Load JavaScript deferred
- Minify JavaScript files
Clear the cache after every change. Testing one option at a time helps you identify the exact cause instead of permanently disabling several useful optimizations.
Also open the browser developer tools and check the Console tab. Errors such as `wpcf7 is not defined`, reCAPTCHA errors or another undefined function usually indicate that a required script is delayed, blocked or loaded in the wrong order.
4. Set the cache lifespan to eight hours
Contact Form 7 uses a WordPress nonce for request validation. If an old cached page contains an expired nonce, submission can fail even though the form looks normal.
Go to:
WP Rocket → Cache → Cache Lifespan
Set the lifespan to 8 hours, save the settings and clear the cache.
WP Rocket specifically recommends an eight-hour cache lifespan when troubleshooting Contact Form 7 nonce issues. See the official [WP Rocket Contact Form 7 compatibility guide](https://docs.wp-rocket.me/article/1495-using-contact-form-7-with-wp-rocket).
5. Clear every cache layer
Clearing only WP Rocket may not be enough. Your website could also be cached by:
- Your hosting provider
- Cloudflare or another CDN
- A server-level cache such as LiteSpeed, Nginx FastCGI or Varnish
- Your browser
Clear each active cache layer and test the form in an incognito or private window.
Avoid running two full-page caching plugins together. For example, WP Rocket should not normally be used alongside another plugin that also provides page caching.
6. Exclude the contact page from caching
If the problem continues because another cache layer keeps serving an expired form, exclude the contact page from caching.
Go to:
WP Rocket → Advanced Rules → Never Cache URLs
Add the page path:
/contact-us/
Use your actual contact page slug if it is different. You may also need to add the same exclusion in your hosting cache or CDN settings.
This is a reliable fallback, although it is better to identify the exact JavaScript or nonce issue first.
7. Check the Contact Form 7 REST API request
Modern Contact Form 7 submissions use the WordPress REST API. Open Chrome Developer Tools, select the **Network** tab and submit the form.
Look for a request containing a path similar to:
/wp-json/contact-form-7/v1/contact-forms/
Check its response status:
– 200: The server accepted the request. Check the returned response and email delivery.
– 403: A firewall, security plugin, reCAPTCHA or CDN rule may be blocking the request.
– 404: WordPress permalinks, REST API access or server rewrite rules may be broken.
– 500: Check the WordPress debug log and server PHP error log.
If you use Wordfence, Cloudflare, ModSecurity or another security system, review its logs before disabling protection. Add a narrow allow rule for the legitimate Contact Form 7 endpoint when necessary.
8. Check reCAPTCHA and cookie-consent settings
Google reCAPTCHA can prevent submission when its JavaScript is delayed or when a cookie-consent tool blocks it until consent is given.
Temporarily disable reCAPTCHA integration and test the form. If submission starts working:
- Exclude the reCAPTCHA script from delayed JavaScript.
- Check the reCAPTCHA site key and secret key.
- Confirm that the keys include the correct domain.
- Review cookie-consent and Content Security Policy rules.
- Check the browser console for reCAPTCHA errors.
Do not leave spam protection disabled on a public form. Use the test only to identify the conflict, then correct the script or security configuration.
9. Form submits, but email does not arrive
If Contact Form 7 displays a success message, WP Rocket is probably not preventing submission. The remaining issue is usually WordPress email delivery.
Check the following:
- The To address in the Contact Form 7 Mail tab is correct.
- The From address uses your website’s domain.
- Your hosting account permits outgoing email.
- SPF, DKIM and DMARC records are configured correctly.
- SMTP is configured through a reputable email provider.
This is a mail-delivery problem, not a caching problem. See our related guide: WordPress Emails Not Sending? Common Causes and Solutions.
Recommended final configuration
For most affected websites, this combination resolves the problem:
- Keep WP Rocket active.
- Set cache lifespan to eight hours.
- Exclude Contact Form 7 scripts from Delay JavaScript Execution only if testing confirms a conflict.
- Exclude reCAPTCHA when it is part of the error.
- Clear hosting and CDN caches after changing settings.
- Exclude the contact page from page caching only if the nonce issue continues.
- Use SMTP when the form submits successfully but messages are not delivered.
Final thoughts
When Contact Form 7 stops submitting after WP Rocket is activated, start with the `?nowprocket` test. Then check delayed JavaScript, the cache lifespan, other cache layers, the REST API request and reCAPTCHA in that order.
Do not disable every optimization permanently. Once you identify the specific conflict, keep the rest of WP Rocket enabled and exclude only the scripts or page that require special handling.
Need help fixing a WordPress plugin conflict, form error or performance issue? Contact KDP Infusion for WordPress troubleshooting and optimization support.
Frequently Asked Questions
Yes. The plugins are generally compatible. Problems are usually caused by a specific JavaScript optimization, an expired cached nonce, another cache layer or a security rule—not simply by having both plugins active.
Logged-in WordPress users are commonly excluded from page caching. Visitors may receive an older cached page containing an expired nonce or incorrectly optimized JavaScript.
No. First test with `?nowprocket`, identify the affected setting and add the narrowest practical exclusion. Disabling the entire plugin removes performance benefits from pages that are working correctly.
An endless spinner usually means the AJAX or REST API request failed, a JavaScript error interrupted the response, or reCAPTCHA did not initialize correctly. Check the browser Console and Network tabs.
It may provide a temporary fix if an expired nonce was cached. Reducing the cache lifespan and checking other cache layers provides a more durable solution.