Home › Forums › Backend Issues (wp-admin) › Limit categories that can be assigned to a specific CF › Reply To: Limit categories that can be assigned to a specific CF
Hi,
I would appreciate help. I tried above solution with small modyfication – I want to exclude one category from front-end form, category ID is 158, acf field slug – tematyka
I put it on the functions.php of my theme:
function blokada_kategorii( $args, $field, $post_id ) {
$args[‘exclude’] = ‘158’;
return $args;
}
add_filter(‘acf/fields/taxonomy/query/name=tematyka’, ‘blokada_kategorii’, 10, 3);
And I get error:
Parse error: syntax error, unexpected ‘=’, expecting ‘,’ or ‘)’ in [shortened]/functions.php on line 202
Line 202 is where add_filter… is
What I did wrong? Or is any other method to exclude one category from the field?
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.