WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 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 | |
| 2430 | $this->schema = $schema; |
| 2431 | |