I am developing a Wordpress plugin, that executes a function on the transition_post_status hook.
When the function gets executed, I want to notify the current editor user what happened on save.
For simplicity, I just added one case here:
add_action('transition_post_status' function($new_status, $old_status, $post) {
if ($old_status === 'publish' && $new_status === 'draft') {
// logic for sending an email here
// show "I messaged your admin" here
}
});
My ideas were to modify the post response somehow or to write my message to a post meta field, however, when my message is in post meta, how am I able to retrieve in the editor and render a new component with it? The second problem would occure with the post response approach as well.