→ Debugging CSS-based templates

For CSS-based templates, FacetWP will automatically try to find the right query.

$is_main_query = ( $query->is_archive || $query->is_search || ( $query->is_main_query() && ! $query->is_singular ) );

FacetWP uses the first query that matches the above criteria. This usually works great, but sometimes it’s necessary to give FacetWP some guidance on which query to use.

No results

FacetWP was unable to auto-detect the post listing

If you’re seeing this error, it’s because FacetWP can’t find a suitable query. This usually happens when there’s a custom WP_Query on a standard WordPress page. See the Usage section on the facetwp_is_main_query page for the solution.

Turn on debug mode

If FacetWP isn’t filtering correctly, it’s because FacetWP is using the wrong query.

To find which query FacetWP is using, go to Settings > FacetWP > Settings, and turn Debug Mode to ON.

Finding the query

Browse to your facet listing, open the browser console, and type in:


This will return lots of debugging data, including the query arguments and SQL.


Ignore irrelevent queries

Let’s say you’ve determine that FacetWP is incorrectly using a query with post_type = edd_wish_list. We’ll just tell FacetWP to ignore the query, using the facetwp_is_main_query filter.

add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
    if ( 'edd_wish_list' == $query->get( 'post_type' ) ) {
        $is_main_query = false;
    return $is_main_query;
}, 10, 2 );