Core Function
View Source on Trac ↗ term_exists()
term_exists( mixed $term, mixed $taxonomy = '', mixed $parent_term = null ) Determines whether a taxonomy term exists.
Parameters 1 required
| Name / Type | Description |
|---|---|
| (int | | string) $term The term to check. Accepts term ID, slug, or name. Required |
| $taxonomy string | Optional. The taxonomy name to use. |
| $parent_term int | Optional. ID of parent term under which to confine the exists search. |
Return Value
(mixed)
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.
Function Information
Since Version
3.0.0
Source File
wp-includes/taxonomy.php
Advertisement