Skip to content

Commit ba67f5b

Browse files
committed
Updatable Attr for Template
1 parent f44545e commit ba67f5b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/wp-includes/rest-api/class-wp-rest-server.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ class WP_REST_Server {
3939
*/
4040
const EDITABLE = 'POST, PUT, PATCH';
4141

42+
/**
43+
* Alias for PUT transport method.
44+
*
45+
* @since 6.9.0
46+
* @var string
47+
*/
48+
const UPDATABLE = 'PUT, PATCH';
49+
4250
/**
4351
* Alias for DELETE transport method.
4452
*

src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public function register_routes() {
6262
'permission_callback' => array( $this, 'create_item_permissions_check' ),
6363
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
6464
),
65+
array(
66+
'methods' => WP_REST_Server::UPDATABLE,
67+
'callback' => array( $this, 'update_item' ),
68+
'permission_callback' => array( $this, 'update_item_permissions_check' ),
69+
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::UPDATABLE ),
70+
),
6571
'schema' => array( $this, 'get_public_item_schema' ),
6672
)
6773
);

0 commit comments

Comments
 (0)