Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been looking to grab a list of custom taxonomies for a custom post type with the titles, descriptions and tag but have not been able to progress or find anything helpful.

Breakdown:

  • I have registered a custom post type 'submissions'
  • I have registered a custom taxonomy 'award-category' that is specifically for the custom post type 'submissions'
  • I'm trying to output a list of title, description and slug for each 'award-category' item (not post, the actual categories).

Any suggestions to point me in the correct direction..

share|improve this question
    
The correct direction: codex.wordpress.org/Class_Reference/… –  vancoder Mar 25 '13 at 17:26
add comment

1 Answer

up vote 1 down vote accepted

Here's how you can output all the custom taxonomies in any template for examination:

<pre>
    <?php 
    $args = array(
      'public'   => true,
      '_builtin' => false
    ); 
    $taxes = get_taxonomies( $args, 'objects');

    foreach ($taxes as $key => $tax) {
        $terms = get_terms( $tax->name, array('hide_empty' => false) ); // return empty ones too!
        foreach ($terms as $key => $term) {
            echo 'term ID ' . $term->term_id . ', term name: ' . $term->name . ', description: ' . $term->description . '<br/>';
        }
    }
    ?> 
</pre>

Please note that depending on how your custom taxonomies were defined your public value may need to be changed to false. Just try both.

Edit: get_terms() will allow you to get all terms for the particular taxonomy.

share|improve this answer
    
Yes this displays the custom taxonomies registered, however I need the actual categories and descriptions within a taxonomy. –  Braunson Mar 25 '13 at 18:24
    
@Braunson just edited my answer, check it out. –  dalbaeb Mar 25 '13 at 18:45
    
That returns an empty array? –  Braunson Mar 25 '13 at 18:56
    
@Braunson did you try changing the public value to false as I noted in my original answer? –  dalbaeb Mar 25 '13 at 18:59
    
Yes with the public value to false returns nothing. –  Braunson Mar 25 '13 at 19:08
show 3 more comments

Your Answer

 
discard

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.