When there are no results in the listing (actually nothing, or a “no results” message) after using facets, but results do appear after a hard page reload, more often than not the issue is a malformed HTML structure of the page. This happens quite often, for example by accidentally copy-pasting a piece of code in the wrong spot.

On AJAX refresh, when using facets, FacetWP processes the HTML between the first opening <body> tag and the first closing </body> tag. When there are multiple opening or closing <body> tags on the page, or if they are missing, or in the wrong place, the processed content/template will not include the listing/results, causing the “no results” issue to happen.

So, if you see this issue, open the page source in your browser, copy the whole HTML into an editor, and check if your HTML structure is sound. Make sure all opening and closing <html></html>, <head></head> and <body></body> tags are present, in the right place, and appearing only once. Pay special attention to the opening <body> and closing </body> tags.

Diagnosing issues with the Console Network XHR Response tab

Another way to diagnose the “no results” issue (and other refresh issues) is to use the browser Console.

Open the Console, then click the “Network” tab. Reload the page, then select the “XHR” tab, and use a facet. You’ll see an item appear that represents the AJAX refresh. Click on the item so the info about it appears. In the “Response” tab of this info will be the JSON that represents the refreshed content:

Getting the template HTML for a FacetWP AJAX refresh, from the JSON Response tab in the Network > XHR tab in the browser Console.
Getting the template HTML for a FacetWP AJAX refresh, from the JSON Response tab in the Network > XHR tab in the browser Console. The above screenshot is from Firefox. Other browsers have similarly named tabs.

If you copy the HTML of the “template” part of the JSON response to an editor, you can check whether that HTML is structured right and if it includes the results. If it does not, check your template file and/or its includes (like the header.php and footer.php files) for stray, duplicate, missing, or unclosed <html>, <head> and <body> tags.

Note that this issue will never happen when using a Listing Builder listing template, because this type of template is processed differently. It can happen on all other supported listing templates though.

Other possible causes for no results

A few other possible causes for seeing “no results” (with or without using facets):

When you see “FacetWP was unable to auto-detect the post listing” instead of no results, this FAQ answer lists a few possible causes.

See also