HTTP/2 301
server: nginx
date: Wed, 23 Jul 2025 08:18:35 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/classes/WP_REST_Controller/get_additional_fields/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
HTTP/2 200
server: nginx
date: Wed, 23 Jul 2025 08:18:36 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
WP_REST_Controller::get_additional_fields() – Method | Developer.WordPress.org
WordPress Developer Resources
WP_REST_Controller::get_additional_fields()
WP_REST_Controller::get_additional_fields( string $object_type = null ): array
Retrieves all of the registered additional fields for a given object-type.
$object_type
stringoptionalThe object type.
Default:null
array Registered additional fields (if any), empty array if none or if the object type could not be inferred.
protected function get_additional_fields( $object_type = null ) {
global $wp_rest_additional_fields;
if ( ! $object_type ) {
$object_type = $this->get_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 ];
}
View all references View on Trac View on GitHub
Version | Description |
---|
4.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.