rest_(post_type)_item_schema хук-фильтрWP 5.4.0

Filters the post's schema.

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

Possible hook names include:

Использование

add_filter( 'rest_(post_type)_item_schema', 'wp_kama_rest_post_type_item_schema_filter' );

/**
 * Function for `rest_(post_type)_item_schema` filter-hook.
 * 
 * @param array $schema Item schema data.
 *
 * @return array
 */
function wp_kama_rest_post_type_item_schema_filter( $schema ){

	// filter...
	return $schema;
}
$schema(массив)
Item schema data.

Список изменений

С версии 5.4.0 Введена.

Где вызывается хук

WP_REST_Posts_Controller::get_item_schema()
rest_(post_type)_item_schema
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 2617
$schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema );

Где используется хук в WordPress

wp-includes/default-filters.php 726
add_filter( 'rest_wp_navigation_item_schema', array( 'WP_Navigation_Fallback', 'update_wp_navigation_post_schema' ) );