set_matched_route example


        $response = apply_filters( 'rest_request_after_callbacks', $response$handler$request );

        if ( is_wp_error( $response ) ) {
            $response = $this->error_to_response( $response );
        } else {
            $response = rest_ensure_response( $response );
        }

        $response->set_matched_route( $route );
        $response->set_matched_handler( $handler );

        return $response;
    }

    /** * Returns if an error occurred during most recent JSON encode/decode. * * Strings to be translated will be in format like * "Encoding error: Maximum stack depth exceeded". * * @since 4.4.0 * * @return false|string Boolean false or string error message. */


        foreach ( $endpoints as $endpoint ) {
            // Remove the redundant preg_match() argument.             unset( $args[0] );

            $request->set_url_params( $args );
            $request->set_attributes( $endpoint );
        }

        $data = $handler->get_data_for_route( $route$endpoints, 'help' );
        $response->set_matched_route( $route );
        break;
    }

    $response->set_data( $data );
    return $response;
}

/** * Sends the "Allow" header to state all methods that can be sent to the current route. * * @since 4.4.0 * * @param WP_REST_Response $response Current response being served. * @param WP_REST_Server $server ResponseHandler instance (usually WP_REST_Server). * @param WP_REST_Request $request The request that was used to make current response. * @return WP_REST_Response Response to be served, with "Allow" header if route has allowed methods. */
Home | Imprint | This part of the site doesn't use cookies.