Languages:
English •
terms 日本語
(Add your language)
Description
Displays a string of linked terms for a post.
Usage
<?php the_terms( $id, $taxonomy, $before, $sep, $after ); ?>
Parameters
- $id
- (integer) (mandatory) Post ID.
- Default: 0
- $taxonomy
- (string) (mandatory) Taxonomy name.
- Default: Empty string
- $before
- (string) (optional) Text to display before the actual tags are displayed.
- Default: Empty string
- $sep
- (string) (optional) Text or character to display between each tag link.
- Default: ', '
- $after
- (string) (optional) Text to display after the last tag.
- Default: Empty string
Return Values
- (false)
- Will return false on failure. Otherwise, it displays the linked terms of a custom taxonomies separated by user defined characters, and will not return a value.
Examples
Get Categories of Current Post
Get a list of current post's categories:
<?php the_terms( $post->ID, 'category', 'categories: ', ' / ' ); ?>
The output of above code will be: categories: TV / Speaker / Monitor
Notes
Change Log
Since: 2.5.0
Source File
the_terms() is located in wp-includes/category-template.php
.
Related