WP_REST_Menus_Controller::prepare_item_for_database() – Prepares a single term for create or update.

You appear to be a bot. Output may be restricted

Description

Prepares a single term for create or update.

Usage

$object = WP_REST_Menus_Controller::prepare_item_for_database( $request );

Parameters

$request
( WP_REST_Request ) required – Request object.

Returns

object Prepared term data.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php


Lines:

1 to 12 of 12
  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;
  }
 

 View on GitHub View on Trac