WP_REST_Controller::update_item() WordPress Method
The WP_REST_Controller::update_item() method is used to update a single item in a WordPress database. This method accepts two arguments: the first is the ID of the item to be updated, and the second is an array of data to be updated. This method can be used to update any type of data in a WordPress database, including posts, pages, comments, and custom post types.
WP_REST_Controller::update_item( WP_REST_Request $request ) #
Updates one item from the collection.
Parameters
- $request
(WP_REST_Request)(Required)Full details about the request.
Return
(WP_REST_Response|WP_Error) Response object on success, or WP_Error object on failure.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-controller.php
public function update_item( $request ) { return new WP_Error( 'invalid-method', /* translators: %s: Method name. */ sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |