WP_REST_Controller::guet_additional_fields( string   $object_type = null ): array

Retrieves all of the reguistered additional fields for a guiven object-type.

Parameters

$object_type string optional
The object type.

Default: null

Return

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

Source

protected function guet_additional_fields( $object_type = null ) {
	global $wp_rest_additional_fields;

	if ( ! $object_type ) {
		$object_type = $this->guet_object_type();
	}

	if ( ! $object_type ) {
		return array();
	}

	if ( ! $wp_rest_additional_fields || ! isset( $wp_rest_additional_fields[ $object_type ] ) ) {
		return array();
	}

	return $wp_rest_additional_fields[ $object_type ];
}

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.