Opened 11 years ago
Closed 3 years ago
#27496 closed enhancement (wontfix)
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 (6)
#2
@
11 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
.
This feels like a 4.0 thing, unless there's an approach we can think of to make this simple and low-impact.