Skip Navigation

[Resolved] Getting a list of custom taxonomies associated with a custom post type

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Saul Baizman 3 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#2023677

Hi there,

I'm trying to retrieve a list of custom taxonomies that are associated with a given custom post. To be clear, I'm trying to retrieve the slugs of the taxonomies, not the taxonomy terms (in other words, the list of taxonomies you see in the WP dashboard in the left column when creating a new post, below "Add New").

I need to retrieve the post type that is associated with a given taxonomy. And yes, I'm aware that a taxonomy can be associated with multiple post types!

Thank you.

Saul

#2023683

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Saul,

I'm not 100% clear on what you're asking. Is it that you want the Taxonomy itself and Not the terms.

Meaning if I have Post Type A.

You want to list out the Taxonomies that are assigned to Post Type A ? Lets say post type has Taxonomy A and Taxonomy B.

You want to list out Taxonomy A slug and Taxonomy B slug and not necessarily the terms of Taxonomy A and B that are assigned to the Posts Under Post Type A.

If this is the case there is no native way to do this with Toolset and custom code is needed to do this. Have a look at this code in the article below.
https://wordpress.stackexchange.com/questions/172645/get-the-post-type-a-taxonomy-is-attached-to

It appears to be doing what you require.

Thanks,
Shane

#2023687

Thanks, Shane! I ended up using get_object_taxonomies().