• toolsmw

    (@toolsmw)


    Hi there,

    First of all, thank you for this great widget! It’s a very helpful tool for my projects.

    I’m currently reaching out because I’ve come across a technical challenge while using the Filter Widget in combination with an Elementor Loop Grid, and I was hoping you could take a look.

    The Setup:

    • Widget: Better Post & Filter Widget
    • Target: Elementor Loop Grid showing Posts.
    • Configuration: I am using “Default Filters” to exclude specific categories from being displayed initially.

    The Problem:

    1. Exclusion ignored: Despite setting categories in “Default Filters” to be excluded, they still show up in the frontend.
    2. Filter Breakdown: As soon as any “Default Filters” are active, the frontend filter stops working. When a user selects a category, the grid becomes completely empty (white space).
    3. No “Not Found” Message: There is no “No posts found” message; the area just stays blank.
    4. Reset fails: Once a filter is clicked, the grid cannot be reset to show all posts again.

    Observation: If I remove all “Default Filters”, the frontend filtering works perfectly fine. It seems there is a query conflict between the pre-defined exclusions and the dynamic user selection.

    Expected Behavior: The Default Filters should hide the selected categories, and the user should still be able to filter the remaining posts without the grid disappearing.

Viewing 1 replies (of 1 total)
  • Plugin Support Dara

    (@dara4)

    Hi toolsmw (@toolsmw),

    Thanks for your detailed explanation, much appreciated.

    From what you describe, there seems to be a misunderstanding of what the “Default Filters” option is intended for. This setting does not exclude categories. Instead, it applies them as if they were already selected by the user on page load. In other words, it adds default filter selections that frontend users cannot see or deselect.

    The other behavior you are observing (“the area just stays blank”) does sound like an unresolved bug. To better understand what is happening, I would need to have a look at the page to see if there are any console errors.

    If your goal is to exclude certain categories by default, you can use the Query ID option under the filter’s Query section and apply a custom query filter.

    Set a Query ID in your Filter Widget, for example: exclude_categories

    Then add this to your theme’s functions.php or a custom plugin (more details on this, in the plugin’s documentation ):

    add_filter( 'bpfwe/filter_query_args/exclude_categories', function( $args, $widget ) {
    
        // Exclude specific category IDs (replace with your own IDs).
        // Replace the taxonomy with your own.
        $excluded_terms = array( 12, 34 );
    
        $args['tax_query'][] = array(
            'taxonomy' => 'category',
            'field'    => 'term_id',
            'terms'    => $excluded_terms,
            'operator' => 'NOT IN',
        );
    
        // Ensure proper relation if multiple tax queries exist.
        if ( isset( $args['tax_query'] ) && count( $args['tax_query'] ) > 1 ) {
            $args['tax_query']['relation'] = 'AND';
        }
    
        return $args;
    
    }, 10, 2 );

    It is also possible to use the Loop Grid’s own custom query. In that case, you should enable the “Include Loop Grid Query ID” option on the filter widget, instead of assigning a separate Query ID to the filter itself.

    If possible, feel free to share a link to the page or a staging site. I’d be happy to take a closer look and give you a more precise answer based on your setup.

    Regards,
    Dara

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.