I made an app which uses Wordpress REST API to fetch data and users can manipulate the data and add their own posts from the app.
The app is written in AngularJS and uses http.post method to add a post and http.put to update the existing post. We are using custom posts which are made with Pods plugin.
I am trying to find an action hook which would fire whenever a user makes a http.post or http.put request to the REST API.
So far I tried:
function on_all_status_transitions( $new_status, $old_status, $post ) {
if ( $new_status != $old_status ) {
// A function to perform actions any time any post changes status.
}
}
add_action( 'transition_post_status', 'on_all_status_transitions', 10, 3 );
And also: add_action(save_post)
Thanks in advance!
Have you tried
rest_post_dispatch
Hook?Allows modification of the response before returning:
https://developer.wordpress.org/reference/hooks/rest_post_dispatch/