WP_REST_Controller::prepare_item_for_database()
Prepares one item for create or update operation.
Method of the class: WP_REST_Controller{}
No Hooks.
Return
Object|WP_Error
. The prepared item, or WP_Error object on failure.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_item_for_database( $request );
- $request(WP_REST_Request) (required)
- Request object.
Changelog
Since 4.7.0 | Introduced. |
WP_REST_Controller::prepare_item_for_database() WP REST Controller::prepare item for database code WP 6.6.2
protected function prepare_item_for_database( $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 ) ); }