rest_{$this->post_type}_item_schema WordPress Filter Hook

The rest_{$this->post_type}_item_schema hook allows you to filter the schema for a particular post type item. This can be useful for adding extra fields to the schema, or for removing fields that you don't want to be exposed in the REST API.

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

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

Top ↑

Parameters

$schema

(array)Item schema data.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.