Y
Y
Yastr2018-04-09 12:06:07
WordPress
Yastr, 2018-04-09 12:06:07

How to get term knowing only its slug?

Is it possible to get data about a term with only its slug?
The most suitable thing I found is the function get_term_by( $field, $value, $taxonomy, $output, $filter );
But the taxonomy is unknown to me, nothing comes out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
E, 2018-04-09
@Yastr

try

get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question