rest_get_route_for_taxonomy_items
函数
rest_get_route_for_taxonomy_items ( $taxonomy )
- 参数
-
-
(string)
$taxonomy
Name of taxonomy.- Required: 是
-
(string)
- 返回值
-
- (string) The route path with a leading slash for the given taxonomy.
- 定义位置
-
-
wp-includes/rest-api.php
, line 3187
-
wp-includes/rest-api.php
- 引入
- 5.9.0
- 弃用
- –
获取一个分类法的REST API路由。
function rest_get_route_for_taxonomy_items( $taxonomy ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return ''; } if ( ! $taxonomy->show_in_rest ) { return ''; } $namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2'; $rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); /** * Filters the REST API route for a taxonomy. * * @since 5.9.0 * * @param string $route The route path. * @param WP_Taxonomy $taxonomy The taxonomy object. */ return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。