diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
index d610504692..1a4883e80d 100644
--- src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
+++ src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
@@ -518,30 +518,43 @@ 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();
+		$properties = isset( $schema['properties'] ) ? $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;
+				$properties[ $field_name ] = $field_options;
 			}
 		}
 
+		// Exclude fields that specify a different context than the request context.
+		$context = $request['context'];
+		if ( $context ) {
+			foreach ( $properties as $name => $options ) {
+				if ( ! empty( $options['context'] ) && ! in_array( $context, $options['context'], true ) ) {
+					unset( $properties[ $name ] );
+				}
+			}
+		}
+
+		$fields = array_keys( $properties );
+
 		if ( ! isset( $request['_fields'] ) ) {
 			return $fields;
 		}
+
 		$requested_fields = wp_parse_list( $request['_fields'] );
 		if ( 0 === count( $requested_fields ) ) {
 			return $fields;
 		}
-		// Trim off outside whitespace from the comma delimited list.
-		$requested_fields = array_map( 'trim', $requested_fields );
+
 		// Always persist 'id', because it can be needed for add_additional_fields_to_object().
 		if ( in_array( 'id', $fields, true ) ) {
 			$requested_fields[] = 'id';
 		}
+
 		return array_intersect( $fields, $requested_fields );
 	}
 
diff --git tests/phpunit/tests/rest-api/rest-controller.php tests/phpunit/tests/rest-api/rest-controller.php
index 6301e64d9d..f130abc62d 100644
--- tests/phpunit/tests/rest-api/rest-controller.php
+++ tests/phpunit/tests/rest-api/rest-controller.php
@@ -255,6 +255,94 @@ class WP_Test_REST_Controller extends WP_Test_REST_TestCase {
 		);
 	}
 
+	public function test_get_fields_for_response_filters_by_context() {
+		$controller = new WP_REST_Test_Controller();
+
+		$request = new WP_REST_Request( 'GET', '/wp/v2/testroute' );
+		$request->set_param( 'context', 'view' );
+
+		$schema = $controller->get_item_schema();
+		$field  = 'somefield';
+
+		$listener = new MockAction();
+		$method   = 'action';
+
+		register_rest_field(
+			$schema['title'],
+			$field,
+			array(
+				'schema'       => array(
+					'type'    => 'string',
+					'context' => array( 'embed' ),
+				),
+				'get_callback' => array( $listener, $method ),
+			)
+		);
+
+		$controller->prepare_item_for_response( array(), $request );
+
+		$this->assertSame( 0, $listener->get_call_count( $method ) );
+
+		$request->set_param( 'context', 'embed' );
+
+		$controller->prepare_item_for_response( array(), $request );
+
+		$this->assertGreaterThan( 0, $listener->get_call_count( $method ) );
+	}
+
+	public function test_filtering_fields_for_response_by_context_returns_fields_with_no_context() {
+		$controller = new WP_REST_Test_Controller();
+
+		$request = new WP_REST_Request( 'GET', '/wp/v2/testroute' );
+		$request->set_param( 'context', 'view' );
+
+		$schema = $controller->get_item_schema();
+		$field  = 'somefield';
+
+		$listener = new MockAction();
+		$method   = 'action';
+
+		register_rest_field(
+			$schema['title'],
+			$field,
+			array(
+				'schema'       => array(
+					'type' => 'string',
+				),
+				'get_callback' => array( $listener, $method ),
+			)
+		);
+
+		$controller->prepare_item_for_response( array(), $request );
+
+		$this->assertGreaterThan( 0, $listener->get_call_count( $method ) );
+	}
+
+	public function test_filtering_fields_for_response_by_context_returns_fields_with_no_schema() {
+		$controller = new WP_REST_Test_Controller();
+
+		$request = new WP_REST_Request( 'GET', '/wp/v2/testroute' );
+		$request->set_param( 'context', 'view' );
+
+		$schema = $controller->get_item_schema();
+		$field  = 'somefield';
+
+		$listener = new MockAction();
+		$method   = 'action';
+
+		register_rest_field(
+			$schema['title'],
+			$field,
+			array(
+				'get_callback' => array( $listener, $method ),
+			)
+		);
+
+		$controller->prepare_item_for_response( array(), $request );
+
+		$this->assertGreaterThan( 0, $listener->get_call_count( $method ) );
+	}
+
 	public function test_add_additional_fields_to_object_respects_fields_param() {
 		$controller = new WP_REST_Test_Controller();
 		$request    = new WP_REST_Request( 'GET', '/wp/v2/testroute' );
