WordPress Hook post_updated doesn’t work in Blocks editor

[ad_1]

Hello!

I’m trying to add a feature to one of my plugins.

I want to trigger a function when a post or a page is being saved after being edited in the blocks editor. Unfortunately my function will not trigger for some reason. The code is however triggered when I use Elementor Page builder on a post but not in regular Block editor. Am I using the wrong hook or is it a bug?

My code:

`add_action(‘post_updated’, array($this, ‘clear_post_page’), 10, 3);`

and:

`public function clear_post_page($post_id, $post_after, $post_before) {`
`error_log(‘THIS TEXT SHOULD BE SHOWN IN DEBUG LOG’);`

`}`

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer