Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_{$this->post_type}_item_schema

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2599            *
2600            *  - `rest_post_item_schema`
2601            *  - `rest_page_item_schema`
2602            *  - `rest_attachment_item_schema`
2603            *
2604            * @since 5.4.0
2605            *
2606            * @param array $schema Item schema data.
2607            */
2608           $schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema );
2609
2610           // Emit a _doing_it_wrong warning if user tries to add new properties using this filter.
2611           $new_fields = array_diff( array_keys( $schema['properties'] ), $schema_fields );
2612           if ( count( $new_fields ) > 0 ) {
2613                _doing_it_wrong(
2614                     __METHOD__,
2615                     sprintf(
2616                          /* translators: %s: register_rest_field */
2617                          __( 'Please use %s to add new schema properties.' ),