WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i get taxonomies of a post type?

If I have a post type event and i need to find out the list of taxonomies that are attached to that post type. How do I find them?

share|improve this question
up vote 25 down vote accepted

Hey guys i think i got it! After looking at couple of functions in taxonomy.php file in WordPress I have found this function get_object_taxonomies(); which did the trick :)

Here is the function

function get_post_taxonomies($post) {
    // Passing an object
    // Why another var?? $output = 'objects'; // name / objects
    $taxonomies = get_object_taxonomies($post, 'objects');

    /*// Passing a string using get_post_type: return (string) post, page, custom...
    $post_type  = get_post_type($post);
    $taxonomies = get_object_taxonomies($post_type, 'objects');*/

    /*// In the loop with the ID
    $theID      = get_the_ID();
    $post_type  = get_post_type($theID);
    $taxonomies = get_object_taxonomies($post_type, 'objects');*/

    // You can also use the global $post

    // edited to fix previous error $taxonomies
    // edited to force type hinting array
    return (array) $taxonomies; // returning array of taxonomies
share|improve this answer
See this for more info: codex.wordpress.org/Function_Reference/get_object_taxonomies – Manny Fleurmond Jun 21 '11 at 13:15
wow... good to know about get_object_taxonomies(). it just helped me hijack template_redirect – helgatheviking Nov 10 '11 at 3:17
Thanks for sharing this resolution, Sisir! – EHerman Jul 16 '15 at 20:47
You are welcome! :) – Sisir Jul 17 '15 at 4:45
Hi thankx for this but how to order them by ID instead of NAME? – dh47 Oct 19 '15 at 7:08

get_categories will do the job.

share|improve this answer
(I think if I understood the question right!) – addedlovely Jun 21 '11 at 11:46
Thing is i don't have any taxonomy name, that's what i want to find out. I only have the name of the post type. By the post type name i want to find out all the taxonomy that are attached to it. Thanks anyway! – Sisir Jun 21 '11 at 12:47

Have you tried anything? something like this?


  'object_type' => array('event') 

$output = 'names'; // or objects
$operator = 'and'; // 'and' or 'or'
if  ($taxonomies) {
  foreach ($taxonomies  as $taxonomy ) {
    echo '<p>'. $taxonomy. '</p>';
share|improve this answer
Looked at get_taxonomies(); function on codex but it has very poor documentation and was no idea how i can pass the post types. – Sisir Jun 21 '11 at 9:56
Sorry, this code is returning all registered taxonomies in wordpress. – Sisir Jun 21 '11 at 9:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.