WP_REST_Controller::get_additional_fields

Advertisement

Summery Summery

Retrieves all of the registered additional fields for a given object-type.

Syntax Syntax

WP_REST_Controller::get_additional_fields( string $object_type = null )

Parameters Parameters

$object_type

(Optional) The object type.

Default value: null

Return Return

(array) Registered additional fields (if any), empty array if none or if the object type could not be inferred.

Source Source

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

	 */
	protected function get_object_type() {
		$schema = $this->get_item_schema();

		if ( ! $schema || ! isset( $schema['title'] ) ) {
			return null;
		}

		return $schema['title'];
	}

	/**
	 * Gets an array of fields to be included on the response.
	 *
	 * Included fields are based on item schema and `_fields=` request argument.
	 *
	 * @since 4.9.6
	 *

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply