[wp-trac] [WordPress Trac] #32264: wp_enqueue_media() is slow on large sites

WordPress Trac noreply at wordpress.org
Tue Jul 28 11:23:18 UTC 2015


#32264: wp_enqueue_media() is slow on large sites
-------------------------------------------------+-------------------------
 Reporter:  philipjohn                           |       Owner:  rhurling
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Posts, Post Types                    |  Review
 Severity:  normal                               |     Version:  3.9
 Keywords:  good-first-bug has-patch needs-      |  Resolution:
  testing                                        |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by philipjohn):

 32264.7.patch makes a start on that @mboynes

 It introduces four new functions:

 `media_has_audio()` is the new home for the transient setting and DB query
 `media_has_video()` as above but for videos
 `media_months()` as above but for the months query
 `wp_check_has_media()` hooks into `add_attachment` and
 `delete_attachment`, checking the current values of the relevant transient
 and deleting it where neccessary and thus causing the calls at wp-
 includes/media.php:2921-2922 to re-create the transient only when needed.

 The transient deletion in wp-includes/post.php has been removed.

 I'm not confident the new functions and `add_action()` calls are really in
 the right place, so feedback welcome there.

 The `media_months` transient still needs to be deleted. I'm thinking an
 additional hook for that, rather than rolling into `wp_check_has_media()`

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


More information about the wp-trac mailing list