Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_post_dispatch

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2968      if ( ! empty( $path_parts['query'] ) ) {
2969           parse_str( $path_parts['query'], $query_params );
2970           $request->set_query_params( $query_params );
2971      }
2972
2973      $response = rest_do_request( $request );
2974      if ( 200 === $response->status ) {
2975           $server = rest_get_server();
2976           /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
2977           $response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request );
2978           $embed    = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false;
2979           $data     = (array) $server->response_to_data( $response, $embed );
2980
2981           if ( 'OPTIONS' === $method ) {
2982                $memo[ $method ][ $path ] = array(
2983                     'body'    => $data,
2984                     'headers' => $response->headers,
2985                );
2986           } else {