1. 首页
  2. WordPress 函数手册
  3. rest

rest_is_field_included()

rest_is_field_included( string $field, array $fields )

给定要包含在响应中的字段数组,其中一些字段可能是`嵌套.fields`,确定提供的字段是否应包含在响应正文中。
Given an array of fields to include in a response, some of which may be `nested.fields`, determine whether the provided field should be included in the response body.

目录锚点:#说明#参数#返回#源码


说明(Description)

如果传入父字段,则该父字段中任何嵌套字段的存在都将导致该方法返回true。例如,“title”将返回true,如果有title,标题.raw或者标题。呈现提供。


参数(Parameters)

参数 类型 必填 说明
$field (string) 必需 要测试响应体中是否包含的字段。
$fields (array) 必需 端点支持的字符串字段数组。

返回(Return)

(bool)是否包含字段。


源码(Source)


更新版本 源码位置 使用 被使用
5.3.0 wp-includes/rest-api.php:792 1 function 0

rest_is_field_included() 为WP2原创文章,链接:https://www.wp2.cn/functions/rest_is_field_included/