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


(string) (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


Changelog Changelog

Version Description
4.7.0 Introduced.


Leave a Reply

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