Support » Plugins » Hacks » get taxonomy objects

  • I know I can get_object_taxonomies('post'), but is there a way to do the reverse: get_taxonomy_objects('category')?

    What I need is a list of all post_types (including posts, pages and custom post types) registered to a certain taxonomy.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I just found that I can do:

    $tax_objects = get_taxonomies('','objects');
    $tax_object_types = $tax_objects['category']->object_type;

    Is that the cleanest way?

    It’s clean. I use the same constructions for taxonomy description:

    $taxonomy = 'team';
    $taxonomy_object = get_taxonomies('','objects');
    print $taxonomy_object[$taxonomy]->description

    and post type description:

    $postType = 'coworker';
    $postType_object = get_post_type_object($postType);
    print $postType_object->description;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get taxonomy objects’ is closed to new replies.