@hube2 thanks for your idea but this is all a very “unbeautiful” solution but it would work – i have tested with “tweaking” the relationship a little to add “hide_empty” true and tested it. But now i found a bug and opened a support case:
I found in line includes\libraries\acf\includes\fields\class-acf-field-relationship.php on line 421: $terms = acf_get_grouped_terms( $term_args );
and i followed the function to api-term.php to line 171. In line 181 i changed ‘hide_empty’ to true and give it a try -> it works BUT here seems to be a BUG:
all taxonomies and their corresponding terms are shown (which are not empty). BUT 2 taxonomies (screenshot) are shown because there is in each one “filled term” but not the term itself. I think the problem is the “same” taxonomie name like für posts. but its only the “label” the same not the taxonomy name. It is “dpf_work_category” and “dpf_work_type” – i think there is the bug.
I changed the registered name from one taxonomy from “dpf_work_category” to “dpf_work_category2” and than the missing term is shown under the category name. SO i think its a bug while checking the taxonomy name against the wordpress built-in category names…..
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.