检索帖子的标签。
原型
get_the_tags( int $id )
参数
$id
(int)
(Required)
帖子ID。
返回值
(array|false|WP_Error)
成功时标记对象的数组,失败时为false。
源文件
路径:wp-includes/category-template.php
<?php
...
function get_the_tags( $id = 0 ) {
/**
* Filters the array of tags for the given post.
*
* @since 2.3.0
*
* @see get_the_terms()
*
* @param array $terms An array of tags for the given post.
*/
return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_the_tags/