How to get all taxonomies of a post type?

The question:

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?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

I think I’ve got it! After looking at couple of functions in the taxonomy.php file in WordPress I have found the function get_object_taxonomies(); which did the trick 🙂

Method 2

get_categories will do the job.


Method 3

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>';

Method 4

$taxonomies = get_taxonomies( [ 'object_type' => [ 'custom_post_type' ] ] );

Method 5

Use get_object_taxonomies (, which takes either the name of your custom post type or a post object as the parameter:

$taxonomies = get_object_taxonomies('custom_post_type');
$taxonomies = get_object_taxonomies($custom_post_object);

get_taxonomies() won’t return any taxonomies that are used by multiple post types (

Method 6


This worked for me.

Method 7

Apologies for raising an old post, but I came across this problem while looking for an answer for my use case.

I wanted to retrieve all available taxonomies for a post type, and also retrieve all available terms per taxonomy.

Thank you to Nick B for setting me in the right direction with his answer:

// get a list of available taxonomies for a post type
$taxonomies = get_taxonomies(['object_type' => ['your_post_type']]);

$taxonomyTerms = [];

// loop over your taxonomies
foreach ($taxonomies as $taxonomy)
  // retrieve all available terms, including those not yet used
  $terms    = get_terms(['taxonomy' => $taxonomy, 'hide_empty' => false]);

  // make sure $terms is an array, as it can be an int (count) or a WP_Error
  $hasTerms = is_array($terms) && $terms;

    $taxonomyTerms[$taxonomy] = $terms;        

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment