I don’t think enabling taxonomy support will automatically pull in taxonomy terms in queries. You will need to link in the taxonomy via a field in metabox / field group associated with the post-type.
ie, you will have to create a field of type ‘taxonomy’ in a field group associated with the post-type. In that field, you tell it which taxonomy to use … and that’s the real link. Enabling a taxonomy on it’s own is just like a capability definition.
I hope I have read your problem right … also, I am certainly far from an expert on the subject 🙂
hi, thanks for the answer.
yes, I think you understood correctly. That is, however, somewhat confusing because creating custom post types in ACF Extended does indeed give the option to specify what taxonomies the type supports and, consequently, the ‘categories’ metabox appears in the ‘new post’ page for the custom post.
all the same, adding a field group for the custom post seems not to pull any custom field in WP_query either..?
The concept of support is only a backend presentation thing, in the sense that those taxonomies show up in backend entry forms for the custom post type … but there is no real linkage as such.
To create a link, you don’t just need a field group … you need to define a field of type ‘taxonomy’ within that field group, and in that field’s definition you choose the taxonomy you want it to link to.
See acf docs on taxonomy field type: https://www.advancedcustomfields.com/resources/taxonomy/
Hello,
Thanks for the feedback! As @laymonk pointed out, Post Types / Taxonomies registration are declarative, what makes the actual link between them is to have a term set on a post.
Once the link is created, in your WP_Query
you’ll have to use the tax_query
parameter in order to retrieve specific posts from specific terms. See WP_Query documentation: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
I would recommend to also take a look at the native register_post_type()
and register_taxonomy()
functions (which are used behind the scene by ACF Extended) to fully understand Post Types & Taxonomies relations.
Hope it helps!
Regards.