WordPress Category

Beginner
6 min read
Updated: Nov 2026
2 examples
Taxonomies

Definition

In WordPress, a taxonomy is a way to group posts. Categories and tags are the two built-in taxonomies. Each item inside a taxonomy is called a term.

Print the categories of a post with the_category(). Print the tags with the_tags(). Show the title of an archive with single_term_title(). Build a category list with wp_list_categories().

Where to use them.

Post term tags go in single.php and the post loop. Archive title tags go in category.php, tag.php, taxonomy.php, or archive.php. List and cloud tags are often used in sidebars.

Syntax

A typical post footer and archive header in a theme:

WordPress
<?php // inside The Loop ?>
<p><?php the_category( ', ' ); ?></p>
<p><?php the_tags(); ?></p>

<?php // in an archive template ?>
<h1><?php single_term_title(); ?></h1>
<?php echo term_description(); ?>

Category vs Tag vs Custom Taxonomy

All three group your content. They differ in how you plan them.

TypeBest forHierarchyName
CategoryMain topics of your site, such as News or Tutorials.Yes. Categories can have child categories.category
TagSmall keywords for details, such as PHP or SEO.No. Tags are flat.post_tag
Custom taxonomyYour own groups, such as Genre or Skill, often for custom post types.Your choice when you register it.Any name you register

Function Groups at a Glance

Pick the group that matches the job, then open the guide you need.

GroupTypical jobStart here
Post termsShow the categories, tags, or custom terms of one post.the_category(), the_tags(), the_terms(), get_the_term_list(), the_taxonomies(), the_category_rss()
Archive titles & descriptionsShow the name and the description of the current archive.single_cat_title(), single_tag_title(), single_term_title(), category_description(), tag_description(), term_description()
Lists, dropdowns & cloudsBuild sidebar lists, select boxes, and tag clouds.wp_list_categories(), wp_dropdown_categories(), wp_tag_cloud(), wp_generate_tag_cloud()

WordPress Examples

Two short theme examples with sample output.

Example 1 — Terms under a post

Show the categories and tags of each post.

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <h2><?php the_title(); ?></h2>
  <p>Posted in: <?php the_category( ', ' ); ?></p>
  <p><?php the_tags( 'Tags: ', ', ', '' ); ?></p>
<?php endwhile; ?>

How It Works

  1. the_category( ', ' ) prints the category links on one line.
  2. the_tags() prints the tag links with your own label.
  3. Both tags run inside The Loop, so they know which post you are showing.

Example 2 — Archive title and description

Show the name and description at the top of a category, tag, or taxonomy archive.

WordPress
<header class="archive-header">
  <h1><?php single_term_title(); ?></h1>
  <?php echo term_description(); ?>
</header>

How It Works

  1. single_term_title() prints the name of the current term.
  2. term_description() returns the description, and echo prints it.
  3. The same code works for categories, tags, and custom taxonomies.

Next: WordPress Category Functions Index

After you know the basics, open the functions index for all sixteen guides.

Full list: WordPress Category Functions index (/wordpress/category/function).

Frequently Asked Questions

Categories are broad groups and can have parent and child categories. Tags are small keywords with no hierarchy. Use categories for the main topics and tags for details.
A custom taxonomy is your own way to group content, such as genre, topic, or skill. It works like categories or tags, but you create it with register_taxonomy().
A term is one item inside a taxonomy. News is a term of the category taxonomy. PHP is a term of the post_tag taxonomy.
Use the_category() for categories and the_tags() for tags. Use the_terms() when you work with a custom taxonomy.
Use single_cat_title() for categories, single_tag_title() for tags, or single_term_title() for any taxonomy.
Open the WordPress Category Functions index. It lists all sixteen guides in simple tables with short descriptions.

Browse every category function

Open the functions index for simple guides with examples and FAQs.

Category Functions Index →

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