Debugging Booking Form Issues
When a visitor submits a booking and the form answers There was an unexpected network error, please try again or contact a site administrator., the booking request reached your server but the server did not send back the reply the form expects. The message is the same whatever went wrong, so the real cause has to be read from the server's response.
This page shows how to read that response, how to get the underlying PHP error, and what to send to support if you can't resolve it.
You need to be able to reproduce the error yourself, on a desktop browser. To read the PHP error log you also need access to the site's files, through your host's file manager or SFTP.
What the error means
The booking form sends its data to wp-admin/admin-ajax.php in the background and expects a JSON reply. It shows the network error when either of these happens:
- The server replies with an error status, such as 403, 500 or 504.
- The server replies with something that is not JSON, such as a PHP error message, a login page or a firewall's block page.
The usual causes, most common first:
| Cause | What the response looks like |
|---|---|
| A PHP error in a plugin, the theme or custom code that runs during the booking | Status 500, or a status 200 response that starts with a PHP warning or error message. |
| A security plugin, firewall or host rule blocking the request | Status 403 or 406, often with the firewall's own page as the response. |
| The request timing out, for example while a slow mail server sends the confirmation email | Status 504, or no response at all after a long wait. |
| Output added to every response by other code, such as a stray space or a notice printed with debugging switched on | Status 200, with extra text before or after the JSON. |
Read the server's response
These steps are for Chrome. Firefox, Edge and Safari have the same tools under similar names.
-
Open the event page and fill in the booking form, but don't submit it yet.
-
Right-click anywhere on the page and choose Inspect. The developer tools open.
-
Click the Network tab. Click the clear button so the list is empty, and select the Fetch/XHR filter so only background requests are listed.
-
Submit the booking form. A request named
admin-ajax.phpappears in the list. A failed request is shown in red. -
Click that request. The Headers tab shows the Status Code. The Response tab (or Preview) shows what the server sent back.
Read the response for a file path or a plugin name. A PHP error names the file it happened in, for example wp-content/plugins/some-plugin/file.php on line 123, which tells you which plugin or theme to look at. A firewall page usually names the product that produced it.
The Console tab of the developer tools also records the failed request, which is useful to copy into a support request.
Get the PHP error
If the response is empty or says only that there has been a critical error, the detail is in the PHP error log. Switch on WordPress's debug log to capture it.
-
Open
wp-config.phpin the root folder of your site. -
Above the line that says
/* That's all, stop editing! */, add these lines, replacing any existingWP_DEBUGline:wp-config.phpdefine( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false ); -
Reproduce the error on the booking form.
-
Open
wp-content/debug.log. The newest entries are at the end. Look for lines that start withPHP Fatal errorat the time of your test. -
When you have what you need, set
WP_DEBUGback tofalseand deletedebug.log, which can be read by anyone who guesses its address.
WP_DEBUG_DISPLAY is set to false on purpose. With it on, notices are printed into every response, and that alone is enough to break the booking form's JSON reply.
Rule out a conflict
Once you know, or suspect, which plugin is involved, confirm it.
-
On a staging copy of the site, deactivate the suspected plugin and submit a booking. If the booking goes through, you have found the cause.
-
If you have no suspect, deactivate every plugin except Events Manager (and Events Manager Pro and your payment gateway, if the booking is paid), switch to a default WordPress theme, and test. Then reactivate the others one at a time, testing after each.
-
For a 403 response, look at your security plugin's log of blocked requests, or ask your host whether a server firewall such as ModSecurity blocked a request to
admin-ajax.phpat the time of your test. They can allow the request without switching the firewall off.
To test on a live site without affecting visitors, see the tip under First steps on the Troubleshooting page.
Ask for help
If the cause is in Events Manager, or you can't tell, post in the support forum with:
- the status code and the text of the response from the Network tab
- the matching lines from
debug.log - the versions of WordPress, PHP, Events Manager and Events Manager Pro
- which payment gateway the booking used, if any
- what the conflict test showed
Remove anything private first. Responses and logs can contain names, email addresses and file paths.