WordPress term_description() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Template tag

Definition

In WordPress, term_description() returns the description of a term. A term can be a category, a tag, or a term from a custom taxonomy.

It returns the text as a string. It does not print it, so use echo to show it. On a term archive it reads the current term when you pass no ID.

Syntax

Call it with no argument on a term archive, or pass a term ID.

WordPress
term_description();
term_description( 12 );
$text = term_description();
CallWhat it does
term_description()Returns the description of the current term on an archive page.
term_description( 12 )Returns the description of the term with ID 12.
$text = term_description()Saves the description in a variable so you can test it first.

A term ID is unique, so you do not need to give the taxonomy name.

Full declaration
WordPress
term_description( int $term = 0, string $deprecated = null ): string

Parameters

ParameterDescription
$termOptional. The term ID. Default 0, which means the current term on an archive page.
$deprecatedOptional. The old taxonomy argument. WordPress no longer uses it. Leave it out.

Return Value

Return ValueDescription
stringThe term description. It may contain basic HTML such as <p>.
empty stringThe term has no description, or the ID is not valid.

WordPress Examples

Three short theme examples. Each one has a sample output.

Example 1 — Current term

Print the description on any category, tag, or taxonomy archive.

WordPress
<?php
echo term_description();
?>

How It Works

  1. On an archive page, WordPress knows the current term.
  2. term_description() returns the saved description.
  3. The same code works for categories, tags, and custom taxonomies.

Example 2 — By term ID

Show the description of a specific term.

WordPress
<?php
echo term_description( 12 );
?>

How It Works

  1. The number 12 is the term ID.
  2. The function returns the description of that term.
  3. This works on any page, not only on archives.

Example 3 — Title and description together

Build a simple archive header.

WordPress
<?php
$text = term_description();
?>
<header class="archive-header">
  <h1><?php single_term_title(); ?></h1>
  <?php if ( $text ) : ?>
    <div class="archive-description"><?php echo $text; ?></div>
  <?php endif; ?>
</header>

How It Works

  1. single_term_title() prints the term name.
  2. term_description() returns the description text.
  3. The if hides the box when there is no description.

Frequently Asked Questions

It returns the description of a term as a string. The default is the current term on an archive page.
Yes. It works for any taxonomy, including categories, tags, and custom taxonomies.
No. The second argument is deprecated and WordPress ignores it. Leave it out.
No. It returns the text. Use echo to print it.
category_description() and tag_description() are small wrappers. term_description() is the general function behind them.

Next: the_category()

Print the categories of the current post as links or a list.

the_category() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful