Support

Account

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);