Home > AI > Backend > Wordpress >

get_term_by

get_term_by( string $field, string|int $value, string $taxonomy = '', string $output = OBJECT, string $filter = 'raw' )

Get all Term data from database by Term field and data.

Example: get category name

$term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') );
echo $term->name;

Leave a Reply