Rest API Hook When Post Is Requested
My original answer was all wrong, so it’s been removed in it’s entirety. Neither the posts_selection nor wp hook are fired during the REST API request. The hook you need is rest_pre_echo_response. This hook passes three parameters: The response data to send to the client The server instance. The request used to generate the response. … Read more