the_tags() WordPress Function

The the_tags() function is used to display a list of tags for the current post.

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 value: null

$sep

(string)(Optional) String to use between the tags.

Default value: ', '

$after

(string)(Optional) String to use after the tags.

Default value: ''


Top ↑

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.


Top ↑

Source

File: wp-includes/category-template.php

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;
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.