#27753 closed defect (bug) (invalid)
wp_enqueue_media() breaks featured image functionality
Reported by: | hovida | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8.2 |
Component: | Media | Keywords: | |
Focuses: | javascript | Cc: |
Description (last modified by )
Hey there,
The bug #23028 still exists.
It was very annoying to find the problem. If you add the wp_enqueue_media functionality on themes or plugins, the media manager wont work correctly.
The bug exists on the actual stable (3.8.2) up to beta releases (tested in 3.9 RC1 and 3.9 RC3).
<?php class Media_Demo { public function __construct() { add_action('admin_init', array($this, 'admin_init')); } public function admin_init() { if(function_exists('wp_enqueue_media')){ wp_enqueue_media(); } else { wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); } } } new Media_Demo(); ?>
Change History (4)
#1
@
11 years ago
- Summary changed from wp_enqueue_media() breaks fetured image functionality (reopen) to wp_enqueue_media() breaks featured image functionality (reopen)
Note: See
TracTickets for help on using
tickets.
wp_enqueue_media()
consumes an arguments hash which includes an option forpost
, which you can pass anything thatget_post()
. This feeds into the JS of the media experience for Edit Post-specific functionality, so it can contextually know which post you are editing. Core does this, and so should you.