[wp-trac] [WordPress Trac] #54016: Media Library: Bulk delete elements in grid view takes very long

WordPress Trac noreply at wordpress.org
Tue Apr 14 10:33:21 UTC 2026


#54016: Media Library: Bulk delete elements in grid view takes very long
-------------------------------------------------+-------------------------
 Reporter:  Presskopp                            |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion needs-testing  |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by darshitrajyaguru97):

 I was able to reproduce the issue locally and can confirm the performance
 concern when performing bulk deletion in the Media Library grid view.

 === Testing details:
 - WordPress: 7.0 RC2
 - Environment: local + medium dataset (~500 images)
 - Browser: Chrome

 === Observations:
 - Bulk delete in grid view triggers multiple sequential AJAX requests (one
 per attachment).
 - UI updates after each deletion, which significantly increases total
 processing time.
 - On larger datasets, this results in noticeable delay and increased
 server load.

 === Comparison:
 - List view bulk delete appears more efficient since it processes via bulk
 action rather than per-item requests.

 === Suggestions:
 - Introducing batched deletion (single request with multiple IDs) could
 improve performance.
 - Alternatively, a hybrid approach:
   - Step 1: Mark items with a temporary status (e.g. `deleting`)
   - Step 2: Process deletion asynchronously in chunks (similar to
 background processing used elsewhere in core)

 === Additional note:
 It may also be worth reviewing whether `_thumbnail_id` and related
 postmeta cleanup can be optimized or deferred to reduce query overhead
 during deletion.

 **Happy to help test any patches if this moves forward.

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


More information about the wp-trac mailing list