Support

Account

Home Forums General Issues taxonomy field – filter to only show parents Reply To: taxonomy field – filter to only show parents

  • For Select or Multiselect dropdown use the below code to query only parents.

    function hide_child_taxonomies( $args, $field ) {
        if( 'YOUR_FIELD_NAME' === $field['_name'] ) {
            $args['parent'] = 0;
        }
        return $args;
    }
    
    add_filter('acf/fields/taxonomy/query', 'hide_child_taxonomies', 10, 3);