Skip to content

REST API: Don't list the data_processing settings in the index. - #15183

Closed
jorgefilipecosta wants to merge 1 commit into
WordPress:trunkfrom
jorgefilipecosta:fix/rest-data-processing-index
Closed

jorgefilipecosta wants to merge 1 commit into
WordPress:trunkfrom
jorgefilipecosta:fix/rest-data-processing-index

Conversation

@jorgefilipecosta

Copy link
Copy Markdown
Member

Follow-up to #14671 (https://core.trac.wordpress.org/changeset/64689).

This PR stops listing the resolved data_processing settings in the root index, the namespace indexes and OPTIONS responses. The option configures how the server processes a response, nothing reads it from the index, and it is new in 7.2, so it can still change before the release.

  • WP_REST_Server::get_data_for_route() no longer adds data_processing to the endpoint data.
  • The index test now asserts the key is absent.

Trac ticket: https://core.trac.wordpress.org/ticket/66372

Testing

Register a trivial endpoint that turns the processing off, for example as a mu-plugin:

add_action(
	'rest_api_init',
	function () {
		register_rest_route(
			'demo/v1',
			'/hello',
			array(
				'methods'             => 'GET',
				'callback'            => function () {
					return array( 'hello' => 'world' );
				},
				'permission_callback' => '__return_true',
				'data_processing'     => false,
			)
		);
	}
);
  1. Run curl -X OPTIONS http://localhost:8889/wp-json/demo/v1/hello. On trunk the endpoint carries "data_processing":{"fields":false,"embed":false,"links":false}; with this PR it is {"methods":["GET"],"args":[]} only. The key disappears from http://localhost:8889/wp-json/demo/v1 and http://localhost:8889/wp-json/ the same way.
  2. Run curl 'http://localhost:8889/wp-json/demo/v1/hello?_fields=nope'. It still returns {"hello":"world"} without _links, so the option itself keeps working.
  3. Verify unit tests are passing:
npm run test:php -- --filter Tests_REST_Server

Drafted with AI assistance (Claude Code) and reviewed by me.

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.
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jorgefilipecosta, sadmansakibnadvi.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@sadmansakibnadvi

Copy link
Copy Markdown

Followed the testing steps on 7.2-beta3-64990. data_processing is gone from the OPTIONS response, the /demo/v1 index and the root index, and ?_fields=nope still returns {"hello":"world"} without _links. Results on the ticket: https://core.trac.wordpress.org/ticket/66372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants