[wp-trac] [WordPress Trac] #28112: bulk_edit_posts() function needs an action hook

WordPress Trac noreply at wordpress.org
Fri Jan 20 22:23:57 UTC 2023


#28112: bulk_edit_posts() function needs an action hook
--------------------------------------+-----------------------
 Reporter:  helgatheviking            |       Owner:  audrasjb
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.2
Component:  Quick/Bulk Edit           |     Version:  3.9
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch needs-dev-note  |     Focuses:
--------------------------------------+-----------------------
Changes (by SergeyBiryukov):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Thanks for the commit!

 I believe comment:17 raises a good point: the current implementation of
 the action accepts `$post_data`, which contains the submitted form
 results, plus some data for the last post in the loop, but the latter is
 not mentioned in the hook documentation and seems confusing for future
 maintenance, as it conflates two different data sets.

 I think passing `$shared_post_data` instead, as suggested in comment:22,
 would be the correct thing to do here. If we do feel strongly about also
 including the post data processed in the loop, it should be consistently
 collected for each post and passed as the second parameter.

 Also, if my reading of comment:3 is correct, it seems like this action
 might not actually be needed after all, as the use case from the ticket
 description can be achieved via existing hooks, e.g `save_post`?
 > All that said, my digging did eventually bring me to the revelation that
 bulk edit is processed by a loop that hits `wp_insert_post()` so actually
 the ability to save bulk edit details doesn't require ajax at all and can
 run on the exact same `save_post` routine that quick edit and meta boxes
 already use.

 With the comment above, are we sure there is still enough demand for this
 hook? I'm all for making core more flexible, but also not sure if it's a
 good idea to introduce hooks just because we can, as they will need to be
 maintained indefinitely due WP's backward compatibility promise.

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


More information about the wp-trac mailing list