wppaste
WordPress

apply_filters( "rest_{$this->post_type}_item_schema", array $schema )

Since
5.4.0
Filters the post's schema.

Description

The dynamic portion of the filter, $this->post_type, refers to the post type slug for the controller.

Possible hook names include:

  • rest_post_item_schema
  • rest_page_item_schema
  • rest_attachment_item_schema

Compatibility

WordPress
since 5.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$schemaarray
Item schema data.

Where this hook fires · 1

  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:2818WP_REST_Posts_Controller::get_item_schema()

Source code

		 *  - `rest_attachment_item_schema`		 *		 * @since 5.4.0		 *		 * @param array $schema Item schema data.		 */		$schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema ); 		// Emit a _doing_it_wrong warning if user tries to add new properties using this filter.		$new_fields = array_diff( array_keys( $schema['properties'] ), $schema_fields );		if ( count( $new_fields ) > 0 ) {			_doing_it_wrong(				__METHOD__,

Changelog

Introduced in 5.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.