Support

Account

Home Forums General Issues What\'s the mistake here?

Solving

What\'s the mistake here?

  • it does not work for me.
    What’s not right here?
    I’m trying to create a filter that will only display one term.
    Thanks

    add_filter('acf/fields/taxonomy/query/name=abc', 'public_term_taxonomy_query', 10, 3);
    function public_term_taxonomy_query( $args, $field, $post_id ) {
        $args[ 'name' ] = [ 'public' ];
        return $args;
    }
  • Moti,

    Try removing the enclosing brackets around the value as follows:

    $args[‘name’] = ‘value’;

  • But I want only one term to be introduced.
    How do I introduce one term from the taxonomy?
    It seems to me that the code I wrote is not good because it does not have an array.

    Can you give me a piece of code that will filter and display only one term out of taxonomy?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.