Custom Post Type UI
[resolved] Cannot display the categories under my custom taxonomy (3 posts)

  1. markyeoj
    Posted 2 years ago #

    I have a problem here, using the plugin I registered a custom post type and I named it 'recipe' then I created a custom taxonomy under the post type, I named it 'recipe category'. Now I want to display the of categories under that custom taxonomy, but unfortunately I have no luck.

    I tried this code

    $taxonomy = 'recipecategory';
    $tax_terms = get_terms($taxonomy);
    foreach ($tax_terms as $tax_term) {
    echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';


  2. Michael Beckwith
    Plugin Author

    Posted 2 years ago #

    Have you created any CPT posts that use it yet? get_terms() hides empty terms by default, so if you have none yet, it won't show anything.


  3. markyeoj
    Posted 2 years ago #

    Ouch, this is very embarrassing.. why i didn't think of that? Thanks @Michael.. great relief.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Type UI
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic