Make WordPress Core


Ignore:
Timestamp:
11/09/2021 01:57:48 AM (3 years ago)
Author:
TimothyBlynJacobs
Message:

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.

File:
1 edited

Legend:

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

    r52016 r52068  
    2424     */
    2525    protected $widgets_retrieved = false;
     26
     27    /**
     28     * Whether the controller supports batching.
     29     *
     30     * @since 5.9.0
     31     * @var array
     32     */
     33    protected $allow_batch = array( 'v1' => true );
    2634
    2735    /**
     
    5765                    'args'                => $this->get_endpoint_args_for_item_schema(),
    5866                ),
    59                 'allow_batch' => array( 'v1' => true ),
     67                'allow_batch' => $this->allow_batch,
    6068                'schema'      => array( $this, 'get_public_item_schema' ),
    6169            )
     
    9199                    ),
    92100                ),
    93                 'allow_batch' => array( 'v1' => true ),
     101                'allow_batch' => $this->allow_batch,
    94102                'schema'      => array( $this, 'get_public_item_schema' ),
    95103            )
Note: See TracChangeset for help on using the changeset viewer.