wp-includes/rest-api.php:1013Given 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.
$fieldstring$fieldsarrayboolfunction rest_is_field_included( $field, $fields ) { if ( in_array( $field, $fields, true ) ) { return true; } foreach ( $fields as $accepted_field ) { /* * Check to see if $field is the parent of any item in $fields. * A field "parent" should be accepted if "parent.child" is accepted. */ if ( str_starts_with( $accepted_field, "$field." ) ) { return true; } /* * Conversely, if "parent" is accepted, all "parent.child" fields * should also be accepted. */ if ( str_starts_with( $field, "$accepted_field." ) ) { return true; } } return false;}Introduced in 5.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/rest-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.