manu
manu

Reputation: 77

How to show taxonomy name in WordPress?

I want show taxonomy name of specific ID. I tried with this code, but doesn't work.

<?php echo get_term_by('id','103', 'casestudies_category') ?>

Upvotes: 1

Views: 208

Answers (1)

Simon Pollard
Simon Pollard

Reputation: 2588

The query returns an object not actual data, see https://developer.wordpress.org/reference/functions/get_term_by/

You will need to access the name you need to use the following:

$term = get_term_by('id','103', 'casestudies_category');
echo $term->name;

Upvotes: 3

Related Questions