If your server is using New Relic, you will likely experience issues with FacetWP. The facets will keep spinning infinitely, and this error will appear in your browser console:

Uncaught SyntaxError: Unexpected token t

Background

New Relic is a performance monitoring application. It tracks user activity and application performance, including page load timing.

New Relic injects JavaScript into your pages using its PHP agent. It takes the HTML generated by WordPress, then uses regular expressions to inject its own scripts.

The problem is that New Relic inadvertently injects itself into FacetWP’s ajax response. Since the scripts aren’t properly escaped, it breaks the JSON object.

Solution

There are several options to resolve the issue:

  1. Disable New Relic (or ask your web host)
  2. Add newrelic_disable_autorum() to template files of FacetWP-enabled pages
  3. Disable browser management features within New Relic’s UI