Home › Forums › ACF PRO › Exclude taxonomy terms from frontend display › Reply To: Exclude taxonomy terms from frontend display
I tried both leanda version and Florian version – none worked. I got no error, just category is still visible in frontend form. What I try to achieve: exclude category with ID 158 from being visible in frontend form, slug of this field is “tematyka”. So my code is:
<?php
add_filter(‘acf/fields/taxonomy/wp_list_categories/name=tematyka’, ‘my_taxonomy_args’, 10, 2);
function my_taxonomy_args( $args, $field )
{
$args[‘exclude’] = array(158); //the IDs of the excluded terms
return $args;
}
?>
I tried also without name, to exclude this category from all fields and forms (though I have only one form):
<?php
add_filter(‘acf/fields/taxonomy/wp_list_categories’, ‘my_taxonomy_args’, 10, 2);
function my_taxonomy_args( $args, $field )
{
$args[‘exclude’] = array(158); //the IDs of the excluded terms
return $args;
}
?>
None worked. What did I wrong?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.