term_description( int $term = 0, mixed $deprecated = null ): string
- Since
- 2.8.0, 4.9.2
- Source
wp-includes/category-template.php:1265
Retrieves term description.
Parameters
$termintoptional- Term ID. Defaults to the current term ID.Default:
0 $deprecatedmixedoptional- Not used.Default:
null
Return
string- Term description, if available.
Uses · 6
- is_tax()Determines whether the query is for an existing custom taxonomy archive page.
- is_tag()Determines whether the query is for an existing tag archive page.
- is_category()Determines whether the query is for an existing category archive page.
- get_queried_object()Retrieves the currently queried object.
- get_term_field()Gets sanitized term field.
- is_wp_error()Checks whether the given variable is a WordPress Error.
Used by · 4
- category_description()Retrieves category description.
- get_the_archive_description()Retrieves the description for an author, post type, or term archive.
- render_block_core_term_description()Renders the `core/term-description` block on the server.
- tag_description()Retrieves tag description.
Source
function term_description( $term = 0, $deprecated = null ) { if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) { $term = get_queried_object(); if ( $term ) { $term = $term->term_id; } } $description = get_term_field( 'description', $term ); return is_wp_error( $description ) ? '' : $description;}History
Introduced in 2.8.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Parameter
$deprecated retyped from null to mixed.verified against source4.9.2
The
$taxonomy parameter was deprecated.from the docblock2.8.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/category-template.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.