I have created a custom post type portfolio_posts using the CPT UI plugin. Using the same plugin, I have created a taxonomy portfolio_category. I have made multiple entries under this taxonomy.

I want to list all the entries under portfolio_category, but all I'm getting is an empty array.

Here's what I've tried:

$args = array(
    'taxonomy' => 'portfolio_category'
$taxonomy = get_categories ($args);
echo '<pre>';

When I replace portfolio_category with category I am successfully getting all the entries under category.

What am I missing here?

Here is a screenshot of the entries under portfolio_category and below is an example of how they are saved in the wp_term_taxonomy table.

How they are saved in wp_term_taxonomy table


Here is how i did it

$taxonomy = get_terms('portfolio_category', array( 'hide_empty' => 0 ));

i am able get all the items under portfolio_category.

$terms = get_the_terms( $post->ID , 'yourtaxonomyhere' ); 

foreach ( $terms as $term ) {

    $term_link = get_term_link( $term, 'yourtaxonomyhere' );

    if ( is_wp_error( $term_link ) )

    echo '<a href="' . $term_link . '">' . $term->name . '</a>';

  • Answers should be more than a code snippet. Please improve your answer with an edit explaining what your code does and how it answers the question. – Gabriel Jun 9 '16 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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