Make WordPress Core


Ignore:
Timestamp:
06/02/2024 08:01:44 PM (6 months ago)
Author:
TimothyBlynJacobs
Message:

REST API: Add batch support to the Users API.

Developers can now include /wp/v2/users routes when making a batch API request.

Props alexminza, timothyblynjacobs, mukesh27.
Fixes #60895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r57648 r58283  
    2424     */
    2525    protected $meta;
     26
     27    /**
     28     * Whether the controller supports batching.
     29     *
     30     * @since 6.6.0
     31     * @var array
     32     */
     33    protected $allow_batch = array( 'v1' => true );
    2634
    2735    /**
     
    6270                    'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
    6371                ),
    64                 'schema' => array( $this, 'get_public_item_schema' ),
     72                'allow_batch' => $this->allow_batch,
     73                'schema'      => array( $this, 'get_public_item_schema' ),
    6574            )
    6675        );
     
    108117                    ),
    109118                ),
    110                 'schema' => array( $this, 'get_public_item_schema' ),
     119                'allow_batch' => $this->allow_batch,
     120                'schema'      => array( $this, 'get_public_item_schema' ),
    111121            )
    112122        );
Note: See TracChangeset for help on using the changeset viewer.