Opened 7 years ago
Closed 7 years ago
#47908 closed defect (bug) (duplicate)
"post_updated" hook not working properly with Gutenberg
| Reported by: | giuse | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Editor | Version: | 5.2.2 |
| Severity: | critical | Keywords: | needs-patch |
| Cc: | Focuses: |
Description (last modified by )
The "post_updated" action hook doesn't work properly when Gutenberg is active.
The content passed to $post_after and $post_before of the following example is always the same, no matter if you change something in the content before the post saving.
Disabling Gutenberg all works as normal.
add_action( 'post_updated','my_post_updated_function',99,3 );
function my_post_updated_function( $post_ID, $post_after,$post_before ){
//$post_after and $post_before are always the same if Gutenberg is active
}
Change History (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hello @giuse,
Thank you for the bug report. I tried to do some investigating and what I found out is that when doing an "Update" using Gutenberg the
post_updatedaction which is supposedly just to fire once is firing twice. The first time provides the correct$post_afterand$post_before. The second time, both variables has the same values, most probably because on the 2nd fire, no changes happened.This bug might be related to this as well - https://github.com/WordPress/gutenberg/issues/11976.