diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 4a00336e34..306afe4161 100644
|
a
|
b
|
class WP_REST_Posts_Controller extends WP_REST_Controller {
|
| 2261 | 2261 | $schema['links'] = $schema_links; |
| 2262 | 2262 | } |
| 2263 | 2263 | |
| | 2264 | $schema = $this->add_additional_fields_schema( $schema ); |
| | 2265 | |
| | 2266 | /** |
| | 2267 | * Filter the post's schema. |
| | 2268 | * |
| | 2269 | * The dynamic part of the filter `$this->post_type` refers to the post |
| | 2270 | * type slug for the controller. |
| | 2271 | * |
| | 2272 | * @since 5.3.0 |
| | 2273 | * |
| | 2274 | * @param array $schema Item schema data. |
| | 2275 | * @param string $this->post_type Post type slug. |
| | 2276 | */ |
| | 2277 | |
| | 2278 | $schema_fields = array_keys( $schema['properties'] ); |
| | 2279 | |
| | 2280 | $schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema ); |
| | 2281 | |
| | 2282 | $new_fields = array_diff( array_keys( $schema['properties']), $schema_fields ); |
| | 2283 | |
| | 2284 | // Emit a _doing_it_wrong warning if user tries to add new properties using this filter. |
| | 2285 | if ( count($new_fields) > 0 ) { |
| | 2286 | _doing_it_wrong(__METHOD__, __( 'Please use register_rest_field to add new properties.' ), '5.3.0' ); |
| | 2287 | } |
| | 2288 | |
| 2264 | 2289 | $this->schema = $schema; |
| 2265 | | return $this->add_additional_fields_schema( $this->schema ); |
| | 2290 | |
| | 2291 | return $schema; |
| 2266 | 2292 | } |
| 2267 | 2293 | |
| 2268 | 2294 | /** |