WordPress at a glance

get_the_tag_list() WP 1.0

Retrieve the tags for a post formatted as a string.

Is the basis for: the_tags()
Works based on: get_the_term_list()
✈ 1 time = 0.004159s = very slow | 50000 times = 3.69s = fast PHP 7.1.2, WP 4.7.3
Hooks from function:
Return

String/false/WP_Error. A list of tags on success, false if there are no terms, WP_Error on failure.

Usage

get_the_tag_list( $before, $sep, $after, $id );
$before(string)
Before tags.
Default: ''
$sep(string)
Between tags.
Default: ''
$after(string)
After tags.
Default: ''
$id(int)
Post ID.
Default: current post

Code of get_the_tag_list: wp-includes/category-template.php VER 4.9.8

<?php
function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {

	/**
	 * Filters the tags list for a given post.
	 *
	 * @since 2.3.0
	 *
	 * @param string $tag_list List of tags.
	 * @param string $before   String to use before tags.
	 * @param string $sep      String to use between the tags.
	 * @param string $after    String to use after tags.
	 * @param int    $id       Post ID.
	 */
	return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
}

Related Functions

From tag: WP Loop

More from category: For posts

No comments
    Hello, !     Log In . Register