Glossary Term
get_term()
get_term() — Gets all term data from database by term ID. The usage of the get_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters. $term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $wpdb returns for the get_row method. There are two hooks, one is specifically for each term, named ‘get_term’, and the second is for the taxonomy name, ‘term_$taxonomy’.
Inputs: $term (int|WP_Term|object): If integer, term data will be fetched from the database, or from the cache if available. If stdClass object (as in the results of a database query), will apply filters and return a WP_Term object with the $term data. If WP_Term, will return $term. $taxonomy (string): Optional. Taxonomy name that $term is part of. $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|WP_Error|null: WP_Term instance (or array) on success, depending on the $output value. WP_Error if $taxonomy does not exist. Null for miscellaneous failure.
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…
