WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 3 weeks ago

#27496 new enhancement

Improve loading of the various media components

Reported by: azaozz Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

The media components are loaded with wp_enqueue_media(). Currently this is used in custom-background.php, custom-header.php, edit-form-advanced.php, class-wp-customize-control.php, and wp-admin/includes/media.php. Not all media components are needed in all of these cases.

The (new) media-audiovideo.js and mce-view.js are needed only when TinyMCE is used. However TinyMCE can be used without the media modal and there is no direct correlation between running the media_buttons action and having media enqueued. For example PressThis uses media_buttons to add its own buttons, the media modal is not used there: https://core.trac.wordpress.org/browser/trunk/src/wp-admin/press-this.php#L632.

Change History (5)

#1 @nacin
5 years ago

This feels like a 4.0 thing, unless there's an approach we can think of to make this simple and low-impact.

#2 @azaozz
5 years ago

  • Type changed from defect (bug) to enhancement

Yeah, agreed. One way would be to pass context to wp_enqueue_media(). Perhaps better would be to add some correlation between WP_Editor and enqueueing media. Not sure how low-impact any of these would be.

Currently the logic is: load everything everywhere. Part of this is in wp_enqueue_media() and another part in script-loader. Perhaps for 3.9 we can add mce-view as dependency for media-views.

#3 @wonderboymusic
5 years ago

There is a patch over here for A/V: #27509

#4 @wonderboymusic
5 years ago

  • Milestone changed from 3.9 to Future Release

Moved some code to mce-view in [27733] and made the dependencies more sane, we can look at this again in 4.0

#5 @chriscct7
4 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.