Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#53063 assigned enhancement

Add batch support to core REST resources

Reported by: chrisvanpatten's profile chrisvanpatten Owned by: timothyblynjacobs's profile TimothyBlynJacobs
Milestone: Future Release Priority: normal
Severity: normal Version: 5.6
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:


#50244 introduced batch operation functionality to the WordPress REST API, but it remains disabled in WordPress' core endpoints. It would be great to see this functionality available on core endpoints for manipulating core resources.

Due to some complexity around GET requests which may spin off expensive queries, a first step may be to only enable batch processing for creatable/editable/deletable requests.

Change History (9)

#1 @TimothyBlynJacobs
3 years ago

  • Milestone changed from Awaiting Review to 5.9
  • Owner set to TimothyBlynJacobs
  • Status changed from new to assigned
  • Version set to 5.6

This ticket was mentioned in PR #1833 on WordPress/wordpress-develop by spacedmonkey.

3 years ago

  • Keywords has-patch added

This ticket was mentioned in PR #1836 on WordPress/wordpress-develop by spacedmonkey.

3 years ago

  • Keywords has-unit-tests added

TimothyBJacobs commented on PR #1836:

3 years ago

Thanks @spacedmonkey! Left two comments, each feedback item appears multiple times.

#5 @TimothyBlynJacobs
3 years ago

In 52068:

REST API: Add batch support for posts and terms controllers.

This also exposes the value of allow_batch in OPTIONS requests to a route.

A future commit will add batch support to more resources.

Props spacedmonkey, chrisvanpatten.
See #53063.

#6 @TimothyBlynJacobs
3 years ago

  • Milestone changed from 5.9 to Future Release
  • Type changed from defect (bug) to enhancement

The necessary parts for 5.9 have been committed.

#7 @TimothyBlynJacobs
3 years ago

In 52070:

REST API: Regenerate wp-api-generated.js after [52068].

See #53063.

#8 @alexminza
3 months ago

We were working on importing a large number of users as part of a migration project to WordPress / WooCommerce to discover that WP REST API does not support batching for Users in WP_REST_Users_Controller since allow_batch is not explicitly set to true in register_rest_route.

Is there a particular reason batching was not enabled for users?
Would it make sense to add this similarly to WP_REST_Posts_Controller?

#9 @alexminza
2 months ago

I submitted a PR enabling batch users operations via REST API here

More details in the ticket

Note: See TracTickets for help on using tickets.