Gets the most appropriate fallback Navigation Menu.
$requestWP_REST_Requestrequired
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;
}
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_navigation_fallback_controller/get_item