get_the_tag_list() WP 1.0
Retrieve the tags for a post formatted as a string.
Works based on: get_the_term_list()
Basis of: the_tags()
1 time = 0.004159s = very slow | 50000 times = 3.69s = fast | PHP 7.1.2, WP 4.7.3
Hooks from the 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, $post_id );
- $before(string)
- String to use before the tags.
Default: '' - $sep(string)
- String to use between the tags.
Default: '' - $after(string)
- String to use after the tags.
Default: '' - $post_id(int)
- Post ID.
Default: current post ID
Changelog
Since 2.3.0 | Introduced. |
Code of get_the_tag_list() get the tag list WP 5.6
function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) {
$tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after );
/**
* 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 the tags.
* @param string $sep String to use between the tags.
* @param string $after String to use after the tags.
* @param int $post_id Post ID.
*/
return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id );
}Related Functions
From tag: WP Loop
More from category: For posts
- get_object_taxonomies()
- get_objects_in_term()
- get_the_category()
- get_the_category_list()
- get_the_taxonomies()
- get_the_term_list()
- get_the_terms()
- has_category()