Custom post type category not displaying in custom post type

I’ve created a new custom post type (lets call it “Reviews”) on the backend of my WordPress. It works fine for the most part but the Categories I create within that Custom Post Type are not displaying on the meta box.

For example, in a normal post, it should say “In Category X”. In the custom post type, that field is empty. Here are two examples:

Working properly:
Not working:

<?php $category_list = get_the_category_list( __( ', ', 'standard' ) ); ?>
<?php if( $category_list ) { ?>
<?php printf( '<span class="the-category">' . __( '%1$s', 'standard' ) . '</span>', $category_list ); ?>
<?php } // end if ?>

You can see the category area is blank. Any suggestions on how to make it show would be greatly appreciated.

Solutions Collecting From Web of "Custom post type category not displaying in custom post type"

Simply use get_the_term_list


echo get_the_term_list( $post->ID, Taxonomy_NAME, '<span class="the-category">', ', ', '</span>' );

just change Taxonomy_NAME to your category taxonomy name, if its the default category taxonomy then change it to 'category'

You are currently using get_the_category_list, this will list all the terms of the ‘category’ taxonomy. Other taxonomies that come bundled with WordPress by default include tags, they’re not post meta as some people would believe, nor are they dedicated tables.

As such they work with all the other taxonomy term APIs. So Instead use get_term_list, passing in the name of your review category taxonomy as the second parameter.

Also I would not do if ( $category_list ), instead it would be less ambiguous to do: if ( !empty( $category_list ) )

e.g. if using with standard categories:

global $post;
$terms =  get_the_term_list( $post->ID, 'category', '<span class="the-category">', ', ', '</span>' );
if( !empty($terms) ){
    echo $terms;
} else {
    // none found?

For finer grained control, you can get the term objects themselves rather than a string using wp_get_object_terms


$terms = wp_get_object_terms($post->ID, 'category');
    if(!is_wp_error( $terms )){
        foreach($terms as $term){
            echo '<span class="the-category"><a href="'.get_term_link($term->slug, 'category').'">'.$term->name.'</a></span>'; 
} else {
    // no terms found

This would allow you to do things such as access term meta using the term ID, which, if you have setup correctly, could be used to store colours and image IDs.

When possible, always use the term oriented functions, rather than the category and tag specific functions. WordPress will end up using them internally anyway to do the same thing, and it makes dealing with custom taxonomies so much easier as you need only learn a single API rather than 2.

This code works for me…taxonomy portfolio:

<span class="post-category"><?php _e('In', 'owd'); ?> <?php the_terms( $post->ID, 'portfolio_category', '', ", ", '' ); ?></span>