WP_REST_Menus_Controller::prepare_item_for_database()publicWP 5.9.0

Prepares a single term for create or update.

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

No Hooks.

Return

Object. Prepared term data.

Usage

$WP_REST_Menus_Controller = new WP_REST_Menus_Controller();
$WP_REST_Menus_Controller->prepare_item_for_database( $request );
$request(WP_REST_Request) (required)
Request object.

Changelog

Since 5.9.0 Introduced.

Code of WP_REST_Menus_Controller::prepare_item_for_database() WP 6.0

public function prepare_item_for_database( $request ) {
	$prepared_term = parent::prepare_item_for_database( $request );

	$schema = $this->get_item_schema();

	if ( isset( $request['name'] ) && ! empty( $schema['properties']['name'] ) ) {
		$prepared_term->{'menu-name'} = $request['name'];
	}

	return $prepared_term;
}