Make WordPress Core

Ticket #39432: 39432.diff

File 39432.diff, 995 bytes (added by rmccue, 7 years ago)

Correctly determine rest_route on the index

  • src/wp-includes/rest-api/class-wp-rest-server.php

     
    291291                }
    292292
    293293                if ( empty( $path ) ) {
     294                        var_dump( $path );
    294295                        if ( isset( $_SERVER['PATH_INFO'] ) ) {
    295296                                $path = $_SERVER['PATH_INFO'];
    296297                        } else {
  • src/wp-includes/rest-api.php

     
    256256        $server = rest_get_server();
    257257
    258258        // Fire off the request.
    259         $server->serve_request( untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ) );
     259        $route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] );
     260        if ( empty( $route ) ) {
     261                $route = '/';
     262        }
     263        $server->serve_request( $route );
    260264
    261265        // We're done.
    262266        die();