WP_Term
- Since
- 4.4.0
- Source
wp-includes/class-wp-term.php:17
Core class used to implement the WP_Term object.
Compatibility
- WordPress
- since 4.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 10
$term_idintpublic- Term ID.
$namestringpublic- The term's name.
$slugstringpublic- The term's slug.
$term_groupintpublic- The term's term_group.
$term_taxonomy_idintpublic- Term Taxonomy ID.
$taxonomystringpublic- The term's taxonomy name.
$descriptionstringpublic- The term's description.
$parentintpublic- ID of a term's parent term.
$countintpublic- Cached object count for this term.
$filterstringpublic- Stores the term object's sanitization level.
Methods · 5
- get_instance()Retrieve WP_Term instance.
- __construct()Constructor.
- filter()Sanitizes term fields, according to the filter type provided.
- to_array()Converts an object to array.
- __get()Getter.
Source code
#[AllowDynamicProperties]final class WP_Term { /** * Term ID. * * @since 4.4.0 * @var int */ public $term_id; /** * The term's name. * * @since 4.4.0 * @var string */ public $name = ''; /** * The term's slug. * * @since 4.4.0 * @var string */ public $slug = ''; /** * The term's term_group. * * @since 4.4.0 * @var int */ public $term_group = ''; /** * Term Taxonomy ID. * * @since 4.4.0 * @var int */ public $term_taxonomy_id = 0; /** * The term's taxonomy name. * * @since 4.4.0 * @var string */ public $taxonomy = ''; /** * The term's description. * * @since 4.4.0 * @var string */ public $description = ''; /** * ID of a term's parent term. * * @since 4.4.0 * @var int */ public $parent = 0; /** * Cached object count for this term. * * @since 4.4.0 * @var int */ public $count = 0; /** * Stores the term object's sanitization level. * * Does not correspond to a database field. *Changelog
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/class-wp-term.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.