WP_REST_Meta_Fields::default_additional_properties_to_false

Advertisement

Summery Summery

Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting is specified.

Syntax Syntax

WP_REST_Meta_Fields::default_additional_properties_to_false( array $schema )

Description Description

This is needed to restrict properties of objects in meta values to only registered items, as the REST API will allow additional properties by default.

Parameters Parameters

$schema

(array) (Required) The schema array.

Return Return

(array)

Source Source

File: wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

	public function check_meta_is_array( $value, $request, $param ) {
		if ( ! is_array( $value ) ) {
			return false;
		}

		return $value;
	}

	/**
	 * Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting
	 * is specified.
	 *
	 * This is needed to restrict properties of objects in meta values to only
	 * registered items, as the REST API will allow additional properties by
	 * default.
	 *
	 * @since 5.3.0
	 *

Advertisement

Changelog Changelog

Changelog
Version Description
5.3.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.