Glossary Term
get_term_by()
get_term_by() — Gets all term data from database by term field and data. Warning: $value is not escaped for ‘name’ $field. You must do it yourself, if required. The default $field is ‘id’, therefore it is possible to also use null for field, but not recommended that you do so. If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the term will be returned. This function will always return the first term that matches the $field- $value-$taxonomy combination specified in the parameters.
Inputs: $field (string): Either ‘slug’, ‘name’, ‘term_id’ (or ‘id’, ‘ID’), or ‘term_taxonomy_id’. $value (string|int): Search for this term value. $taxonomy (string): Taxonomy name. Optional, if $field is ‘term_taxonomy_id’. $output (string): Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT. $filter (string): Optional. How to sanitize term fields. Default ‘raw’.
Returns WP_Term|array|false: WP_Term instance (or array) on success, depending on the $output value. False if $taxonomy does not exist or $term was not found.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
