Navigation überspringen

[Gelöst] Excluding category from default view, but keep in search

This support ticket is created vor 1 year. There's a good chance that you are reading advice that it now obsolete.

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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 17 Antworten, hat 1 Stimme.

Zuletzt aktualisiert von allisonD vor 11 months, 2 weeks.

Assistiert von: Minesh.

Author
Artikel
#2818427

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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.