WP_REST_Navigation_Fallback_Controller::get_item()
Gets the most appropriate fallback Navigation Menu.
Method of the class: WP_REST_Navigation_Fallback_Controller{}
No Hooks.
Return
WP_REST_Response|WP_Error
. Response object on success, or WP_Error object on failure.
Usage
$WP_REST_Navigation_Fallback_Controller = new WP_REST_Navigation_Fallback_Controller(); $WP_REST_Navigation_Fallback_Controller->get_item( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Changelog
Since 6.3.0 | Introduced. |
WP_REST_Navigation_Fallback_Controller::get_item() WP REST Navigation Fallback Controller::get item code WP 6.7.1
public function get_item( $request ) { $post = WP_Navigation_Fallback::get_fallback(); if ( empty( $post ) ) { return rest_ensure_response( new WP_Error( 'no_fallback_menu', __( 'No fallback menu found.' ), array( 'status' => 404 ) ) ); } $response = $this->prepare_item_for_response( $post, $request ); return $response; }