mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52068 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -48,6 +48,14 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
*/
|
||||
protected $total_terms;
|
||||
|
||||
/**
|
||||
* Whether the controller supports batching.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @var array
|
||||
*/
|
||||
protected $allow_batch = array( 'v1' => true );
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -89,7 +97,8 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
'allow_batch' => $this->allow_batch,
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -97,7 +106,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
$this->namespace,
|
||||
'/' . $this->rest_base . '/(?P<id>[\d]+)',
|
||||
array(
|
||||
'args' => array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the term.' ),
|
||||
'type' => 'integer',
|
||||
@@ -129,7 +138,8 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
'allow_batch' => $this->allow_batch,
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user