钩子文档

rest_endpoints_description

💡 云策文档标注

概述

rest_endpoints_description 是一个 WordPress REST API 过滤器,用于修改单个路由的公开可见数据。它允许开发者在获取路由数据时进行自定义处理。

关键要点

  • 过滤器名称:rest_endpoints_description
  • 参数:$data(数组类型,表示路由的公开可见数据)
  • 应用场景:在 WP_REST_Server::get_data_for_routes() 方法中调用,用于检索路由的公开数据
  • 引入版本:WordPress 4.4.0

代码示例

$available[ $route ] = apply_filters( 'rest_endpoints_description', $data );

📄 原文内容

Filters the publicly-visible data for a single REST API route.

Parameters

$dataarray
Publicly-visible data for the route.

Source

$available[ $route ] = apply_filters( 'rest_endpoints_description', $data );

Changelog

Version Description
4.4.0 Introduced.