WordPress at a glance
function is not described

WP_REST_Controller::prepare_item_for_database() protected WP 4.7.0

Prepares one item for create or update operation.

{} It's a method of the class: WP_REST_Controller{}

No Hooks.


Object|WP_Error. The prepared item, or WP_Error object on failure.


// protected - for code of main (parent) or child class
$result = $this->prepare_item_for_database( $request );
$request(WP_REST_Request) (required)
Request object.


Since 4.7.0 Introduced.

Code of WP_REST_Controller::prepare_item_for_database() WP 5.7.2

protected function prepare_item_for_database( $request ) {
	return new WP_Error(
		/* translators: %s: Method name. */
		sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
		array( 'status' => 405 )