get_the_tag_list

Advertisement

Summery Summery

Retrieve the tags for a post formatted as a string.

Syntax Syntax

get_the_tag_list( string $before = '', string $sep = '', string $after = '', int $id )

Parameters Parameters

$before

(Optional) Before tags.

Default value: ''

$sep

(Optional) Between tags.

Default value: ''

$after

(Optional) After tags.

Default value: ''

$id

(Optional) Post ID. Defaults to the current post.

Return Return

(string|false|WP_Error) A list of tags on success, false if there are no terms, WP_Error on failure.

Source Source

File: wp-includes/category-template.php

 */
function get_tag_link( $tag ) {
	return get_category_link( $tag );
}

/**
 * Retrieves the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $post_id Post ID.
 * @return array|false|WP_Error Array of tag objects on success, false on failure.
 */
function get_the_tags( $post_id = 0 ) {
	$terms = get_the_terms( $post_id, 'post_tag' );

Advertisement

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Advertisement

Leave a Reply