Enable Debug Mode

Debug Mode helps with debugging by providing additional low-level information. Turn on Debug Mode via FacetWP’s Settings tab, then hit “Save changes”.

Using Debug Mode to pinpoint issues

When Debug Mode is enabled, FacetWP adds extra data into the browser console. To access it, go to a front-end page with facets, open your browser’s inspector, go to the Console tab and type FWP.settings.debug:

FWP.settings.debug; // all debug info
FWP.settings.debug.hooks_used; // the names (and paths) of relevant custom hooks
FWP.settings.debug.query_args; // query arguments
FWP.settings.debug.sql; // the raw SQL
FWP.settings.pager; // pager data

A good starting point would be FWP.settings.pager. If the counts look way off, then FacetWP is likely using the wrong query:

Next, look at the query_args. Does the post_type match what you’re expecting (same goes for the other arguments)?

FWP.settings.debug.sql follows along the same lines as the query arguments, but gives you the raw SQL to inspect. Sometime the SQL doesn’t match up with the query arguments, hinting at perhaps a conflict with some 3rd party plugin.

Forcing FacetWP to ignore queries

Let’s say you’ve determine that FacetWP is incorrectly using a query with post_type = edd_wish_list. You can force 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 );

See also