WordPress at Your Fingertips
function is not described

WP_REST_Application_Passwords_Controller::prepare_item_for_database() protected WP 5.6.0

Prepares an application password for a create or update operation.

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

Hooks from the method
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 5.6.0 Introduced.

Code of WP_REST_Application_Passwords_Controller::prepare_item_for_database() WP 5.8

<?php
protected function prepare_item_for_database( $request ) {
	$prepared = (object) array(
		'name' => $request['name'],
	);

	if ( $request['app_id'] && ! $request['uuid'] ) {
		$prepared->app_id = $request['app_id'];
	}

	/**
	 * Filters an application password before it is inserted via the REST API.
	 *
	 * @since 5.6.0
	 *
	 * @param stdClass        $prepared An object representing a single application password prepared for inserting or updating the database.
	 * @param WP_REST_Request $request  Request object.
	 */
	return apply_filters( 'rest_pre_insert_application_password', $prepared, $request );
}