I have a query is there any way to place only the parent categories when the taxonomy is selected
Right now it does:
– Category 1
– Subcategory 1
– Subcategory 2
– Subcategory 3
– Category 2
– Category 3
Change it to this way:
– Category 1
– Category 2
– Category 3
And then there is another option to select the sub category of the parent category.
– Subcategory 1
– Subcategory 2
– Subcategory 3
This need arises because I have about 30 parent categories and each category has 35 children = totally 1050 categories
I found this helping to select parent categories
function my_taxonomy_query( $args, $field, $post_id ) {
// modify args
$args['parent'] = 0;
// return
return $args;
}
add_filter('acf/fields/taxonomy/query', 'my_taxonomy_query', 10, 3);
Image example: http://prntscr.com/e5i7a7
I created another custom field to select the child category, but how would it work?