Do something when publish a post in Gutenberg with hook rest_after_insert_post

Question

I want to send my post to Telegram when it is created. I have read discussion here and inspected these code from n7studio, but I am not sure why my code doesn’t work. Isn’t rest_after_insert_post fire when post are being published from REST API and Gutenberg?

add_action('rest_after_insert_post', 'send_posts_to_Telegram', 10, 3);

function send_posts_to_Telegram($post, $request, $creating = true){
//Send post to Telegram
}
0
, Winston 4 years 2020-03-07T11:56:42-05:00 0 Answers 237 views 0

Leave an answer

Browse
Browse