get_the_tag_list

函数
get_the_tag_list ( $before = '', $sep = '', $after = '', $post_id = 0 )
参数
  • (string) $before Optional. String to use before the tags. Default empty.
    Required:
    Default: (empty)
  • (string) $sep Optional. String to use between the tags. Default empty.
    Required:
    Default: (empty)
  • (string) $after Optional. String to use after the tags. Default empty.
    Required:
    Default: (empty)
  • (int) $post_id Optional. Post ID. Defaults to the current post ID.
    Required:
返回值
  • (string|false|WP_Error) A list of tags on success, false if there are no terms, WP_Error on failure.
定义位置
相关方法
get_the_tagsget_the_term_listget_the_category_listget_the_titleget_theme_feature_list
引入
2.3.0
弃用
-

get_the_tag_list: 这个函数返回当前文章或作为参数传递给它的文章的标签列表。

检索一个文章的标签,格式为字符串。

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

常见问题

FAQs
查看更多 >