Skip to main content

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.

Before you start

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:

CauseWhat the response looks like
A PHP error in a plugin, the theme or custom code that runs during the bookingStatus 500, or a status 200 response that starts with a PHP warning or error message.
A security plugin, firewall or host rule blocking the requestStatus 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 emailStatus 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 onStatus 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.

  1. Open the event page and fill in the booking form, but don't submit it yet.

  2. Right-click anywhere on the page and choose Inspect. The developer tools open.

  3. 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.

  4. Submit the booking form. A request named admin-ajax.php appears in the list. A failed request is shown in red.

  5. 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.

  1. Open wp-config.php in the root folder of your site.

  2. Above the line that says /* That's all, stop editing! */, add these lines, replacing any existing WP_DEBUG line:

    wp-config.php
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
  3. Reproduce the error on the booking form.

  4. Open wp-content/debug.log. The newest entries are at the end. Look for lines that start with PHP Fatal error at the time of your test.

  5. When you have what you need, set WP_DEBUG back to false and delete debug.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.

  1. 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.

  2. 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.

  3. 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.php at 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.