Add custom post type taxonomies in WordPress

Add this to your functions.php file:

function build_taxonomies() {
    register_taxonomy( 'skills_used', 'case', array(
    'hierarchical' => true,
    'label' => 'Skills Used',
    'query_var' => true,
    'rewrite' => true ) );
}
add_action( 'init', 'build_taxonomies', 0 );

And add this inside The Loop to get all taxonomies for custom post type:

the_terms( $post->ID, 'skills_used', '', ' · ' );

[ the_terms( $post->ID, 'Name of taxonomy', 'Before separator', 'Separator', 'After separator' ); ]

Leave a Reply