rest_post_dispatch

rest_post_dispatch

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7

apply_filters('rest_post_dispatch') is found 4 times:

  • /wp-includes/rest-api/class-wp-rest-server.php line 462
    		 * @param WP_HTTP_Response $result  Result to send to the client. Usually a `WP_REST_Response`.
    		 * @param WP_REST_Server   $server  Server instance.
    		 * @param WP_REST_Request  $request Request used to generate the response.
    		 */
    		$result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $request );
    
    		// Wrap the response in an envelope if asked for.
    		if ( isset( $_GET['_envelope'] ) ) {
    			$embed  = isset( $_GET['_embed'] ) ? rest_parse_embed_param( $_GET['_embed'] ) : false;
    			$result = $this->envelope_response( $result, $embed );
    		}
    
  • /wp-includes/rest-api/class-wp-rest-server.php line 823
     
    					$response = $this->dispatch( $request );
    
    					/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
    					$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request );
    
    					$this->embed_cache[ $item['href'] ] = $this->response_to_data( $response, false );
    				}
    
    				$embeds[] = $this->embed_cache[ $item['href'] ];
    			}
    
  • /wp-includes/rest-api/class-wp-rest-server.php line 1857
    				}
    			}
    
    			/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
    			$result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $single_request );
    
    			$responses[] = $this->envelope_response( $result, false )->get_data();
    		}
    
    		return new WP_REST_Response( array( 'responses' => $responses ), WP_Http::MULTI_STATUS );
    	}
    
  • /wp-includes/rest-api.php line 2961
    	$response = rest_do_request( $request );
    	if ( 200 === $response->status ) {
    		$server = rest_get_server();
    		/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
    		$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request );
    		$embed    = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false;
    		$data     = (array) $server->response_to_data( $response, $embed );
    
    		if ( 'OPTIONS' === $method ) {
    			$memo[ $method ][ $path ] = array(
    				'body'    => $data,
    

See this hook used in plugins: