WP_REST_Application_Passwords_Controller::prepare_item_for_database() WordPress Method

The WP_REST_Application_Passwords_Controller::prepare_item_for_database() method is used to prepare an item for insertion into the database. This method is called when creating or updating an item.

WP_REST_Application_Passwords_Controller::prepare_item_for_database( WP_REST_Request $request ) #

Prepares an application password for a create or update operation.


Parameters

$request

(WP_REST_Request)(Required)Request object.


Top ↑

Return

(object|WP_Error) The prepared item, or WP_Error object on failure.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php

577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
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 );
}


Top ↑

Changelog

Changelog
VersionDescription
5.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.