This happens when you are using a Listing Builder listing on a category/term or search achive page.

On category/term/tag and search archive pages, FacetWP will automatically detect and use the native archive query. This means that on WP archives, the recommended approach is to just use the WP archive query itself, instead of creating a new query with the Listing Builder (or a custom WP_Query).

If you do add a Listing Builder listing on a WP archive, what happens is that before filtering, FacetWP uses the native query. And to generate the filtered results, it will use the Listing Builder listing query, which will get all posts/products.

To fix this difference, you can use the facetwp_template_use_archive filter. With this hook in place, FacetWP will automatically pre-filter the Listing Builder query based on the current category/tag/term or search term(s), by injecting them into the query arguments during filtering.

Note that even with this hook in place the native archive query will still be used before filtering. This may lead to differences before and after filtering, caused by query arguments other than the current category/tag/term or search term(s), like posts_per_page, order and orderby. These differences can be fixed by manually bringing the native archive/search query arguments in line with the Listing Builder listing’s query arguments with a pre_get_posts filter. Or by forcing FacetWP to entirely ignore the archive query.

See also

Last updated: January 24, 2025