I had made a taxonomy field in which i have given option for selecting some brands. I must say Puma etc.
Now I have made categories like footwear, clothing etc. Now I want to display all the categories that has selected brand Puma
I want to know just like post where we call post based on meta value. Can we call categories base on taxnomy meta value, that I created with ACF PRO
Just to clarify for future readers:
You are using the taxonomy ‘category’ with a custom field (taxonomy) to select multiple ‘brands’, where ‘brand’ is a taxonomy type.
You care now trying to query the DB for all categories which contain a brand value.
The problem here is that WP does not offer a termeta table (like postmeta) and doesn’t offer any functions to query terms via a custom field.
ACF saves term custom field values into the wp_options table which makes it very hard to query.
Unfortunately, you can’t join the tables together due to the way the data is saved, and you will need to consider 1 of these 2 options:
1. Change your ‘category’ from a taxonomy to a post_type. This will allow for much simpler querying
2. Load all categories, and then loop over them, load the ACF data for each (get_field) and use PHP to compare the data. This is not very efficient but will work