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
339            *
340            * Allows modification of the response before returning.
341            *
342            * @since 4.4.0
343            *
344            * @param WP_HTTP_Response $result  Result to send to the client. Usually a WP_REST_Response.
345            * @param WP_REST_Server   $this    Server instance.
346            * @param WP_REST_Request  $request Request used to generate the response.
347            */
348           $result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $request );
349
350           // Wrap the response in an envelope if asked for.
351           if ( isset( $_GET['_envelope'] ) ) {
352                $result = $this->envelope_response( $result, isset( $_GET['_embed'] ) );
353           }
354
355           // Send extra data from response objects.
356           $headers = $result->get_headers();
357           $this->send_headers( $headers );