[wp-trac] [WordPress Trac] #45114: Fire publishing related hooks after all data is saved via the REST API.

WordPress Trac noreply at wordpress.org
Wed Jul 29 05:28:00 UTC 2020


#45114: Fire publishing related hooks after all data is saved via the REST API.
---------------------------+------------------------------
 Reporter:  peterwilsoncc  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  reopened
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  REST API       |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  dev-feedback   |     Focuses:
---------------------------+------------------------------

Comment (by peterwilsoncc):

 @kraftbj

 Thanks for the patch.

 For updates, I think moving `wp_insert_post()` ends up reversing the
 problem.

 The post term and meta data functions' filters end up running before the
 post content is updated, the first thing that comes to mind is the
 potential for this to cause problems with `wp_update_term_count()` and
 family when the post status changes.

 Similar is true for inserting but with `auto-draft` it's not as much of an
 issue.

 FWIW, I have been experimenting with a plugin to handle this but once I
 started writing unit tests it proved to be broken. I haven't been able to
 find an approach that doesn't involve firing the after post updates in a
 seperate function.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45114#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list