Skip Navigation

[Resolved] Hide taxonomy term

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 10 replies, has 3 voices.

Last updated by leilaG 1 year, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2497999

Hello, how do we hide a taxonomy term - hidden link

Hide term: Flexible location

Thanks

#2498333

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

I visited the link, but I couldn't find the text "Flexible location" anywhere on the page, so I'm not sure what the context is for this term that you want to hide.

Could you clarify?

#2498441
flex-loc.png

Hello, I've attached a screen shot with the taxonomy term highlighted. Thanks

#2498775

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

First of all I would like to know how the "Locations" are configured - is it setup as custom field or taxonomy?

#2498967

It's a taxonomy

#2498997

Minesh
Supporter

Languages: English (English )

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

Toolset views offer the filter hook "wpv_filter_taxonomy_frontend_search_get_terms_args" which you can use to filter your taxonomy filter arguments:
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_frontend_search_get_terms_args

Can you please try to add the following code to "Custom Code" section offered by Toolset:
=>

add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'func_include_exclude_tags', 10, 3 );
function func_include_exclude_tags( $args, $tax, $view_id ){
  
    if ( $view_id == 5533 && $tax = 'tax-slug' ){
  
        // Edit array of term IDs to exclude in your case its "Flexible location" instead of 1,2,3
        $args['exclude'] = array( 1, 2, 3 );
         
    }
  
    return $args;
}

Where:
- Replace tax-slug with your original taxonomy slug
- Add the term ID of your "Flexible location" term to exclude

#2500809

Hello,

We only want it to be hidden on specific pages/CPT's. Is there a way to do it with css?

We use the taxonomy list on other CPT's on the site:

We want it to show on this one hidden link
It's already hidden it here (But can not remember how it was done) hidden link

Also want to hide it here - hidden link

#2500847

Minesh
Supporter

Languages: English (English )

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

Can you please share admin access details so I can check what hook you have used to hide the term.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site.

I have set the next reply to private which means only you and I have access to it.

#2501179

Minesh
Supporter

Languages: English (English )

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

I could not able to access the theme files as I have to check if any filter hook added before to remove the term. I try the FTP/SFTP access details you shared with me but its not working at this end.

Could you please send me working FTP/SFTP access details so I can check theme file if any custom hooks added to it.

I have set the next reply to private which means only you and I have access to it.

#2501333

Minesh
Supporter

Languages: English (English )

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

Thank you for the details and now SFTP access detail is working.

I checked the functions.php file and there are few hooks added belongs to Toolset but not the one that remove the term.

I've added the following code that will remove the "Flexible location" term from the view number 5533 which is added on the following page: hidden link

add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'func_include_exclude_terms', 10, 3 );
function func_include_exclude_terms($args, $tax, $view_id ){
   
    if ( $view_id == 5533 && $tax = 'location' ){
   
        // Edit array of term IDs to exclude in your case its "Flexible location" instead of 1,2,3
        $args['exclude'] = array(269);  // 269 is term ID of  "Flexible location" term
          
    }
   
    return $args;
}

Can you please confirm it works as expected now.

#2503301

Works perfectly. Thank you Minesh!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.