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

  • 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?