- Timestamp:
- 02/11/2020 04:26:56 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r47233 r47265 2407 2407 } 2408 2408 2409 // Take a snapshot of which fields are in the schema pre-filtering. 2410 $schema_fields = array_keys( $schema['properties'] ); 2411 2412 /** 2413 * Filter the post's schema. 2414 * 2415 * The dynamic portion of the filter, `$this->post_type`, refers to the 2416 * post type slug for the controller. 2417 * 2418 * @since 5.4.0 2419 * 2420 * @param array $schema Item schema data. 2421 */ 2422 $schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema ); 2423 2424 // Emit a _doing_it_wrong warning if user tries to add new properties using this filter. 2425 $new_fields = array_diff( array_keys( $schema['properties'] ), $schema_fields ); 2426 if ( count( $new_fields ) > 0 ) { 2427 _doing_it_wrong( __METHOD__, __( 'Please use register_rest_field to add new schema properties.' ), '5.4.0' ); 2428 } 2429 2409 2430 $this->schema = $schema; 2410 2431
Note: See TracChangeset
for help on using the changeset viewer.