忘れるのでメモ。見出しのタグなどに使ったり。
//所属しているターム名(カテゴリー名)を1つ表示 <?php $terms = get_the_terms($post->ID, 'taxonomy名'); foreach($terms as $term){ $term_name = $term->name; echo $term_name; break; }; ?> //所属しているターム名(カテゴリー名)一覧を表示(リンク有) <?php echo get_the_term_list( $post->ID, 'taxonomy名', '<div>', '区切り部分のhtml', '</div>'); ?> //所属しているターム名(カテゴリー名)一覧を表示(リンク無) <?php $terms = get_the_terms($post->ID, 'taxonomy名'); $t_slug=''; foreach($terms as $term){ $term_name = $term->name; $t_slug = $t_slug.$term_name.'区切り部分のhtml'; }; $t_slug = substr($t_slug, 0, -1); echo $t_slug; ?>