diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-controller.php index f98d1ad57e..caee7204ea 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-controller.php @@ -519,6 +519,16 @@ abstract class WP_REST_Controller { public function get_fields_for_response( $request ) { $schema = $this->get_item_schema(); $fields = isset( $schema['properties'] ) ? array_keys( $schema['properties'] ) : array(); + + $additional_fields = $this->get_additional_fields(); + foreach ( $additional_fields as $field_name => $field_options ) { + // For back-compat, include any field with an empty schema + // because it won't be present in $this->get_item_schema(). + if ( is_null( $field_options['schema'] ) ) { + $fields[] = $field_name; + } + } + if ( ! isset( $request['_fields'] ) ) { return $fields; } diff --git a/wp-includes/version.php b/wp-includes/version.php index d6ea670880..22ca5d3164 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-beta5-43907'; +$wp_version = '5.0-beta5-43908'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.