term_exists


term_exists ( $term, $taxonomy = '', $parent = null )

Parameters:
  • (int|string) term The term to check. Accepts term ID, slug, or name.
  • (string) taxonomy Optional. The taxonomy name to use.
  • (int) parent Optional. ID of parent term under which to confine the exists search.
Returns:
  • (mixed) Returns null if the term does not exist. Returns the term ID if no taxonomy is specified and the term ID exists. Returns an array of the term ID and the term taxonomy ID if the taxonomy is specified and the pairing exists. Returns 0 if term ID 0 is passed to the function.
Defined at:

Description

Determines whether a taxonomy term exists.Formerly is_term(), introduced in 2.3.0. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.

Related Functions

email_exists, category_exists, username_exists, tag_exists, post_exists

Top Google Results

User discussions

wpseek mobile