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
Been struggling with this as well. Based on the above using the following in hopes of having my ACF category field only show two categories, the ones with an id of 10 and 16. The field name is “event-category”. When using the below in functions.php, it does not take any affect so assuming I’m missing something. Any thoughts? Also is there a way to set either 10 or 16 to be checked by default on new posts in the custom post type?
function training_taxonomy_query( $args, $field, $post_id ) {
$args[‘include’] = ‘10,16’;
return $args;
}
add_filter(‘acf/fields/taxonomy/queryname=event_category’, ‘training_taxonomy_query’, 10, 3);
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.