get_the_tag_list()
最后更新于:2021-11-27 02:45:27
get_the_tag_list( string$before=”, string$sep=”, string$after=”, int$post_id)Retrieves the tags for a post formatted as a string.
参数
- $before
-
(string) (Optional) String to use before the tags.
Default value: ”
- $sep
-
(string) (Optional) String to use between the tags.
Default value: ”
- $after
-
(string) (Optional) String to use after the tags.
Default value: ”
- $post_id
-
(int) (Optional) Post ID. Defaults to the current post ID.
响应
(string|false|GC_Error) A list of tags on success, false if there are no terms, GC_Error on failure.
源文件
文件: gc-includes/category-template.php
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 );
}