WordPress multiple admin notices on post update/add

Question

I am working on post integrations with a third party system. So, when an admin create/update a postm, we use wp_insert_post hook and composer a xml feed and push it to third party system. and it comes back with some response, now we want to show that response in post notice along with default notice (Post Updated/Created etc)

add_action('wp_insert_post', array($this, 'ourcustomfunction'), 12);
function ourcustomfunction(){
//send xml to 3rd party system and json response from them.

   add_action('admin_notice', 'custom_notice');
}
function custom_notice(){
echo '<div class="notice error-notice">CUSTOM NOTICE TEXT</div>';
}

When I debug, it does not go to custom_notice function…

Any help will be appreciated.
Thanks

0
Sohaib Gondal 2 months 2022-06-06T01:02:51-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse