the_tags( string $before = null, string $sep = ', ', string $after = '' )
Displays the tags for a post.
Parameters
-
$before
string Optional -
String to use before the tags. Defaults to
'Tags:'
.Default:
null
-
$sep
string Optional -
String to use between the tags.
Default:
', '
-
$after
string Optional -
String to use after the tags.
Default:
''
More Information
This function returns an array of objects, one object for each tag assigned to the post. If this function is used in The Loop, then no ID need be passed.
Source
File: wp-includes/category-template.php
.
View all references
function the_tags( $before = null, $sep = ', ', $after = '' ) {
if ( null === $before ) {
$before = __( 'Tags: ' );
}
$the_tags = get_the_tag_list( $before, $sep, $after );
if ( ! is_wp_error( $the_tags ) ) {
echo $the_tags;
}
}
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Default Usage
The default usage lists tags with each tag (if more than one) separated by a comma (,) and preceded with the default text Tags: .
Separated by Commas
Displays a list of the tags with a line break after it.
Separated by Arrow
Displays links to tags with an arrow (>) separating the tags and preceded with the text Social tagging:
Separated by a Bullet
Displays links to tags with a bullet (•) separating the tags and preceded with the text Tagged with: and followed by a line break.
A List Example
Displays a list of the tags as an unordered list:
Parameters lists
null
as default$before
in definition and args list, but alsoTags:
in args listActual default outputs
Tags:
currently