钩子文档

rest_route_for_taxonomy_items

💡 云策文档标注

概述

此文档介绍 WordPress 的 REST API 钩子 'rest_route_for_taxonomy_items',用于过滤分类法的 REST API 路由路径。开发者可以通过此钩子自定义路由,以适配特定需求。

关键要点

  • 钩子名称:rest_route_for_taxonomy_items
  • 参数:$route(路由路径字符串)和 $taxonomy(WP_Taxonomy 对象)
  • 用途:允许修改分类法在 REST API 中的路由路径
  • 相关函数:rest_get_route_for_taxonomy_items(),用于获取分类法的 REST API 路由
  • 引入版本:WordPress 5.9.0

代码示例

apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy );

📄 原文内容

Filters the REST API route for a taxonomy.

Parameters

$routestring
The route path.
$taxonomyWP_Taxonomy
The taxonomy object.

Source

return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy );

Changelog

Version Description
5.9.0 Introduced.