public function prepare_item_for_response( $item, $request ) { $data = array(); $fields = $this->get_fields_for_response( $request ); if ( rest_is_field_included( 'id', $fields ) ) { $data['id'] = (int) $item->ID; } $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; $data = $this->add_additional_fields_to_object( $data, $request ); $data = $this->filter_response_by_context( $data, $context ); $response = rest_ensure_response( $data ); if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) { $links = $this->prepare_links( $item ); $response->add_links( $links ); } return $response; } /** * Prepares the links for the request. * * @since 6.3.0 * * @param WP_Post $post the Navigation Menu post object. * @return array Links for the given request. */ private function prepare_links( $post ) { return array( 'self' => array( 'href' => rest_url( rest_get_route_for_post( $post->ID ) ), 'embeddable' => true, ), ); } }
Fatal error: Uncaught Error: Class "WP_REST_Navigation_Fallback_Controller" not found in /htdocs/wp-includes/rest-api.php:413 Stack trace: #0 /htdocs/wp-includes/class-wp-hook.php(324): create_initial_rest_routes(Object(WP_REST_Server)) #1 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /htdocs/wp-includes/rest-api.php(618): do_action('rest_api_init', Object(WP_REST_Server)) #4 /htdocs/wp-includes/rest-api.php(442): rest_get_server() #5 /htdocs/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP)) #6 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #7 /htdocs/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #8 /htdocs/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array) #9 /htdocs/wp-includes/class-wp.php(813): WP->parse_request('') #10 /htdocs/wp-includes/functions.php(1336): WP->main('') #11 /htdocs/wp-blog-header.php(16): wp() #12 /htdocs/index.php(17): require('/htdocs/wp-blog...') #13 {main} thrown in /htdocs/wp-includes/rest-api.php on line 413