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: 這個函式返回當前文章或作為引數傳遞給它的文章的標籤列表。

檢索一個文章的標籤,格式為字串。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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
檢視更多 >