Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress get taxonomy name by term id

Is there a way to pull taxonomy name just by using term id? Like i have a term_id and i don't know which taxonomy it belongs to and need to get the taxonomy name that it belongs too. any way?

Thanks!

like image 401
krozero Avatar asked Mar 21 '17 16:03

krozero


People also ask

How do I get post terms in WordPress?

wp_get_post_terms( int $post_id, string|string[] $taxonomy = 'post_tag' array $args = array() ): array|WP_Error. Retrieves the terms for a post.

How do I find taxonomy images in WordPress?

Go to your WP-admin ->Settings menu a new “Taxonomy Image” page is created. Go to your WP-admin ->Settings ->Taxonomy Image displayed in the taxonomies list form where you can select the taxonomies you want to include it in WP Custom Taxonomy Image.


1 Answers

You can use get_term(): https://codex.wordpress.org/Function_Reference/get_term

$term = get_term( $term_id );
echo $term->taxonomy;
like image 99
Carl Knapp Avatar answered Oct 05 '22 10:10

Carl Knapp