Make WordPress Core

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 SergeyBiryukov)

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)

#1 @donmhico
7 years ago

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_updated action which is supposedly just to fire once is firing twice. The first time provides the correct $post_after and $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.

#2 @SergeyBiryukov
7 years ago

  • Component General → Editor
  • Description modified (diff)

Related: #47576

#3 @peterwilsoncc
7 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Thanks for the report @giuse.

This is being tracked in #45114 so I'm going to close this ticket as a duplicate so conversation can be kept in one place.

Note: See TracTickets for help on using tickets.