Home Forums General Issues Relationship using multiple taxonomies


Relationship using multiple taxonomies

  • I have three distinct taxonomies; industries, practice areas, and services. I’ve created a custom field called Featured Topic that can be one of the many options within the three aforementioned taxonomies. When I choose taxonomy under the relationship selection, I must choose only one taxonomy and I’d like to combine all three.

    How can I achieve this?

  • You can’t… Well, I should say, you can’t easily. The taxonomy field only stores the term ID. In order to get the term you must know the taxonomy, which ACF only stores as part of the taxonomy. Also, for the “Save Terms” and “Load Terms” options, the taxonomy must also be know, again, that information is not part of the value of the field.

    In order to do this you’d have to have a field that includes information about the taxonomy and the term. You could possibly build this with a select field and dynamically generate the value for it, for the values you could include the taxonomy name and term ID, or you could potentially use the WP term_taxonomy_is from the wp_term_taxonomy table. But if you want to save and load these terms when saving a post you’d also need to work out the details of that yourself as well and usin wp_set_post_terms() inside of an acf/save_post filter If you have a lot of terms the select field would be huge.

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

The topic ‘Relationship using multiple taxonomies’ is closed to new replies.