WordPress filter hook · part of WordPress core

rest_post_dispatch

A WordPress core filter that 14 plugins also fire themselves, running on 94K+ sites between them.

“This filter is documented in wp-includes/rest-api/class-wp-rest-server.php”

How to use rest_post_dispatch

It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'rest_post_dispatch', function( $do_request, $server, $request ) {
	// Change $do_request here.
	return $do_request;
}, 10, 3 );

Argument names come from Easy MCP AI's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

14 plugins that fire rest_post_dispatch

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Uncanny Automator icon Uncanny Automator40,000+ installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), rest_get_server(), $request ) src/app/Recipe_Builder/Shared/Content/Utilities/Post_Content_Request_Scope.php:48
  2. Easy MCP AI icon Easy MCP AI40,000+ installs apply_filters( 'rest_post_dispatch', rest_do_request( $request ), rest_get_server(), $request ) includes/tools/class-base-tool.php:560
  3. SupportCandy icon SupportCandy10,000+ installs apply_filters( 'rest_post_dispatch', rest_ensure_response( rest_do_request( $request ) ), rest_get_server(), $request ) includes/admin/ai-assistant/admin/class-wpsc-ps-ai-functions.php:935
  4. OpenStation icon OpenStation1,000+ installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request ) includes/framework/wordpress.php:674
  5. Customize Posts icon Customize Posts1,000+ installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $rest_response ), $wp_rest_server, $request ) php/class-wp-customize-posts-preview.php:1540
  6. Funnelforms Free icon Funnelforms Free1,000+ installs apply_filters( 'rest_post_dispatch', $response, $server, $request ) src/Http/FormBridge.php:129
  7. Groundhogg icon Groundhogg1,000+ installs apply_filters( 'rest_post_dispatch', rest_do_request( $request ), rest_get_server(), $request ) includes/mcp/connection.php:509
  8. MarketPowerWP icon MarketPowerWP10+ installs apply_filters( 'rest_post_dispatch', rest_ensure_response($result), $wp_rest_server, $request ) src/LePlugin/Api/ApiCall.php:48
  9. Cliedesk icon CliedeskFewer than 10 installs apply_filters( 'rest_post_dispatch', rest_ensure_response( rest_do_request( $sub ) ), rest_get_server(), $sub ) src/Rest/RestServer.php:503
  10. MAIA icon MAIAFewer than 10 installs apply_filters( 'rest_post_dispatch', $response, rest_get_server(), $request ) src/Abilities/Rest/AbstractRestAbility.php:45
  11. Loyalty Points, Rewards and Cashback for WooCommerce icon Loyalty Points, Rewards and Cashback for WooCommerceFewer than 10 installs apply_filters( 'rest_post_dispatch', $response, $server, $request ) scripts/test-storefront.php:478
  12. Yozo AI Marketing Agent icon Yozo AI Marketing AgentFewer than 10 installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $inner ) includes/class-yozo-widget-passthrough.php:160
  13. Live Visitor Analytics icon Live Visitor AnalyticsFewer than 10 installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $server, $request ) includes/class-pqanalytics-fast.php:187
  14. Prozence icon ProzenceFewer than 10 installs apply_filters( 'rest_post_dispatch', rest_ensure_response( $y ), $sunucu, $alt ) inc/toplu.php:79

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.