get_data_for_route example


        }

        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. */

    public function get_data_for_routes( $routes$context = 'view' ) {
        $available = array();

        // Find the available routes.         foreach ( $routes as $route => $callbacks ) {
            $data = $this->get_data_for_route( $route$callbacks$context );
            if ( empty( $data ) ) {
                continue;
            }

            /** * Filters the publicly-visible data for a single REST API route. * * @since 4.4.0 * * @param array $data Publicly-visible data for the route. */
            
Home | Imprint | This part of the site doesn't use cookies.