function _rest_array_intersect_key_recursive( $array1,
$array2 ) { $array1 =
array_intersect_key( $array1,
$array2 );
foreach ( $array1 as $key =>
$value ) { if ( is_array( $value ) &&
is_array( $array2[ $key ] ) ) { $array1[ $key ] =
_rest_array_intersect_key_recursive( $value,
$array2[ $key ] );
} } return $array1;
}/**
* Filters the REST API response to include only a white-listed set of response object fields.
*
* @since 4.8.0
*
* @param WP_REST_Response $response Current response being served.
* @param WP_REST_Server $server ResponseHandler instance (usually WP_REST_Server).
* @param WP_REST_Request $request The request that was used to make current response.
* @return WP_REST_Response Response to be served, trimmed down to contain a subset of fields.
*/