term_description
Retrieve term description.
Description
Returns (string)
Term description, available.
Parameters (2)
- 0. $term — Optional. (int)
- Term ID. Will use global term ID by default.
- 1. $taxonomy — Optional. (string) =>
'post_tag'
- Taxonomy name. Defaults to post_tag..
Usage
if ( !function_exists( 'term_description' ) ) { require_once ABSPATH . WPINC . '/category-template.php'; } // Optional. Term ID. Will use global term ID by default. $term = -1; // Optional taxonomy name. Defaults to 'post_tag'. $taxonomy = 'post_tag'; // NOTICE! Understand what this does before running. $result = term_description($term, $taxonomy);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/category-template.php
- function term_description( $term = 0, $taxonomy = 'post_tag' ) {
- $term = get_queried_object();
- if ( $term ) {
- $taxonomy = $term->taxonomy;
- $term = $term->term_id;
- }
- }
- $description = get_term_field( 'description', $term, $taxonomy );
- return is_wp_error( $description ) ? '' : $description;
- }