Exclude taxonomy terms
-
Hi, I scanned the whole web and found some threads about this, but none of those solutions worked for me.
For example here https://support.advancedcustomfields.com/forums/topic/exclude-taxonomy-terms-from-frontend-display/I added many variants of this code
add_filter('acf/fields/taxonomy/wp_list_categories', 'my_taxonomy_args', 10, 2); function my_taxonomy_args( $args, $field ) { $args['exclude'] = array(16, 15, 17); //the IDs of the excluded terms return $args; }
also with specific field name
add_filter('acf/fields/taxonomy/wp_list_categories/name=test_tax2', 'my_taxonomy_args', 10, 2); function my_taxonomy_args( $args, $field ) { $args['exclude'] = array(64,65,66); //the IDs of the excluded terms return $args; }
and with the
query
function instead ofwp_list_categories
But I always end up with all the terms in the taxonomy field.Is there any workaround this?
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Exclude taxonomy terms’ is closed to new replies.