Skip Navigation

[Resolved] Excluding category from default view, but keep in search

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 1 voice.

Last updated by allisonD 6 days ago.

Assisted by: Minesh.

Author
Posts
#2818427

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I just checked and I found that you did not activated the code snippet.

Can you plesae activate the code snippet you added at "Custom code" section and check if that helps yout resolve your issue.

#2818928
Screenshot 2025-08-04 124428.png

It is active, as shown in the previous screenshot I shared and this one. Unless there is another place I need to "activate" it.

#2819046

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please try to use the following code and check if that help you to resolve your issue:

add_filter( 'wpv_filter_query', 'exclude_term_by_slug_on_initial_load', 10, 3 );
function exclude_term_by_slug_on_initial_load( $query_args, $view_settings, $view_id ) {
     
    $taxonomy_slug  = 'employee-type'; // Replace with your taxonomy (e.g. 'category')
    $exclude_term_slug = 'emeritus'; // The slug of the term to exclude
  
    if ( $view_id == 21529) {
          
            $query_args['tax_query'][] = array(
                'taxonomy' => $taxonomy_slug,
                'field'    => 'slug', // use slug here
                'terms'    => array( $exclude_term_slug ),
                'operator' => 'NOT IN',
            );
      
    }
  
    return $query_args;
}
#2819390

Yes this worked! Thank you so much for your help Minesh.