From 33095025d82ff141fe223140d76ec96917bb7040 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Thu, 29 Oct 2026 15:24:18 +0000 Subject: [PATCH] REST API: Don't list the `data_processing` settings in the index. The root index, the namespace indexes and OPTIONS responses described the resolved `data_processing` settings of every endpoint that turns a feature off. The option configures how the server processes a response, so the index does not need to describe it. Follow-up to [64689]. See #66372. --- src/wp-includes/rest-api/class-wp-rest-server.php | 6 ------ tests/phpunit/tests/rest-api/rest-server.php | 12 ++---------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php index ed583cc900655..612b00e780915 100644 --- a/src/wp-includes/rest-api/class-wp-rest-server.php +++ b/src/wp-includes/rest-api/class-wp-rest-server.php @@ -1861,12 +1861,6 @@ public function get_data_for_route( $route, $callbacks, $context = 'view' ) { $endpoint_data['allow_batch'] = $callback_batch; } - $data_processing = self::resolve_data_processing( $callback, $route_options ); - - if ( in_array( false, $data_processing, true ) ) { - $endpoint_data['data_processing'] = $data_processing; - } - if ( isset( $callback['args'] ) ) { $endpoint_data['args'] = array(); diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php index 3ff82c7231fd1..f0c2e098ebddb 100644 --- a/tests/phpunit/tests/rest-api/rest-server.php +++ b/tests/phpunit/tests/rest-api/rest-server.php @@ -3576,7 +3576,7 @@ public function test_data_processing_applies_to_batch_requests(): void { /** * @ticket 66372 */ - public function test_data_processing_is_listed_in_the_index(): void { + public function test_data_processing_is_not_listed_in_the_index(): void { rest_get_server()->register_route( 'test-ns', '/test-ns/data-processing', @@ -3600,15 +3600,7 @@ public function test_data_processing_is_listed_in_the_index(): void { $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertSame( - array( - 'fields' => false, - 'embed' => true, - 'links' => true, - ), - $data['endpoints'][0]['data_processing'], - 'An endpoint with a feature turned off should list the settings.' - ); + $this->assertArrayNotHasKey( 'data_processing', $data['endpoints'][0], 'An endpoint with a feature turned off should not list the settings.' ); $this->assertArrayNotHasKey( 'data_processing', $data['endpoints'][1], 'An endpoint with every feature on should not list the settings.' ); }