So I have created a custom post type and under that taxonomy named “Category” which serves for categories. How can I list all the categories from there?
2 s
If you just want to list them you can use the get_terms function:
$terms = get_terms( 'my_taxonomy' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . $term->name . '</li>';
}
echo '</ul>';
}
Read the codex, it has a lot of examples:
https://codex.wordpress.org/Function_Reference/get_terms