wp_add_fields_to_navigation_fallback_embedded_links()
云策文档标注
概述
该函数用于在 Navigation Fallback REST 端点的可嵌入链接中暴露额外字段,以支持编辑器使用导航菜单。
关键要点
- 函数 wp_add_fields_to_navigation_fallback_embedded_links() 修改 REST 端点模式,暴露更多字段。
- 默认情况下,Posts Controller 仅暴露有限字段,但编辑器需要额外字段来利用菜单。
- 该函数接受 $schema 数组参数并返回修改后的模式数组。
代码示例
wp_add_fields_to_navigation_fallback_embedded_links( $schema )注意事项
- 该函数从 WordPress 6.3.0 版本开始引入。
- 参数 $schema 是必需的,表示 wp_navigation 文章的模式。
原文内容
Expose additional fields in the embeddable links of the Navigation Fallback REST endpoint.
Description
The endpoint may embed the full Navigation Menu object into the response as the self link. By default, the Posts Controller will only expose a limited subset of fields but the editor requires additional fields to be available in order to utilize the menu.
Parameters
$schemaarrayrequired-
the schema for the
wp_navigationpost.
Source
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |