Codex

Function Reference/the terms

Contents

Description

Displays the terms of a custom taxonomies.

Usage

 <?php the_terms$id$taxonomy$before$sep$after ); ?> 

Parameters

$id 
(int) Post ID.
$taxonomy
(string) Taxonomy name.
$before 
(string) Text to display before the actual tags are displayed. The default is to display nothing.
$separator 
(string) Text or character to display between each tag link. The default is a comma (,) between each tag.
$after 
(string) Text to display after the last tag. The default is to display nothing.

Return Values

(false|wp_error)

or

Displays the terms of a custom taxonomies separated by user defined characters.

Examples

Get categories of current post

get a list of current posts categories:

<?php the_terms( $post->ID, 'category', 'categories: ', ' <span style="color:#000">/</span> ', '' ); ?>

The output of above code will be: categories: TV / Speaker / Monitor

Change Log

Since: 2.5.0

Source File

the_terms() is located in wp-includes/category-template.php.

This page is marked as incomplete. You can help Codex by expanding it.