If Contact Form 7 isn’t working on your WordPress site or is returning a 500 error, it might be due to the All-in-One Security (AIOS) plugin blocking REST API requests. A user may experience a "hanging" contact form after clicking the submit or send button. The form appears stuck and doesn’t send the submission as expected. Note that the 500 error is not immediately visible on the front end; it will only appear in your logs when WordPress debugging is active.
Understanding the issue
Contact Form 7 relies on WordPress’s REST API to process form submissions. When the AIOS plugin is configured to Disallow unauthorized REST requests, it blocks these critical API calls. This means that instead of receiving a clear error message on your website, the form simply hangs, leaving users confused about why their submission isn’t going through.
- Hidden Errors: The underlying 500 error won’t be visible unless you enable debugging and check the error logs.
- Debugging: To view the error details, set
WP_DEBUG
to true in yourwp-config.php
. This will reveal the 500 error in your logs, confirming the REST API block as the culprit.
Two ways to resolve the issue
1. Whitelist Contact Form 7’s REST API Endpoints
Many versions of Contact Form 7 include an option to whitelist its own REST API endpoints. By whitelisting these endpoints, you allow Contact Form 7 to bypass the AIOS security restrictions while keeping the rest of your site protected. To do this, review the Contact Form 7 settings and ensure that the REST API endpoints are allowed. Enable the Whitelist REST routes: toggle.
2. Disable the REST API block in the AIOS plugin
If whitelisting isn’t an option or if you prefer a more straightforward fix, you can disable the feature that blocks REST API requests in the AIOS plugin. Follow these steps:
- Step 1: Log in to your WordPress admin dashboard.
- Step 2: Navigate to WP Security > Firewall > WP REST API.
- Step 3: Find the option labeled Disallow unauthorized REST requests.
- Step 4: Ensure that this option is not checked.
- Step 5: Save your changes and test your Contact Form 7 to confirm that it is now working properly.
Why resolving this matters
Allowing Contact Form 7 to communicate via the REST API is essential for processing form submissions smoothly. By whitelisting the necessary endpoints or disabling the REST API block, you eliminate the hanging issue and the underlying 500 error, ensuring a better user experience and maintaining the overall security of your website.
Final thoughts
When your users experience a hanging contact form, it can be frustrating and confusing. Understanding that the issue is likely due to REST API restrictions from the AIOS plugin helps in quickly pinpointing the problem. Whether you choose to whitelist the REST API endpoints or disable the blocking feature, these steps will restore your form’s functionality and enhance user satisfaction.
By following these guidelines, you can resolve the issue and keep your website running smoothly. Happy troubleshooting!