函数
get_tags ( $args = '' )
- 参数
-
-
(string|array)
$args
{ Optional. Arguments to retrieve tags. See get_terms() for additional options. @type string $taxonomy Taxonomy to retrieve terms for. Default ‘post_tag’. }- Required: 否
- Default: (empty)
-
(string|array)
- 返回值
-
- (WP_Term[]|int|WP_Error) Array of ‘post_tag’ term objects, a count thereof, or WP_Error if any of the taxonomies do not exist.
- 定义位置
-
-
wp-includes/category.php
, line 293
-
wp-includes/category.php
- 引入
- 2.3.0
- 弃用
- –
Retrieves all post tags.
function get_tags( $args = '' ) { $defaults = array( 'taxonomy' => 'post_tag' ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( $args ); if ( empty( $tags ) ) { $tags = array(); } else { /** * Filters the array of term objects returned for the 'post_tag' taxonomy. * * @since 2.3.0 * * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof, * or WP_Error if any of the taxonomies do not exist. * @param array $args An array of arguments. @see get_terms() */ $tags = apply_filters( 'get_tags', $tags, $args ); } return $tags; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。