In media_buttons(), consult global post_ID if get_post() comes up with nothing.
Default postID to 0 in wp_enqueue_media(). Props nacin fixes #22085 git-svn-id: https://develop.svn.wordpress.org/trunk@22846 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
390e1756a1
commit
7ce1968d15
@ -383,8 +383,12 @@ document.body.className = document.body.className.replace('no-js', 'js');
|
||||
* @param string $editor_id
|
||||
*/
|
||||
function media_buttons($editor_id = 'content') {
|
||||
$post = get_post();
|
||||
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
|
||||
$post = $GLOBALS['post_ID'];
|
||||
|
||||
wp_enqueue_media( array(
|
||||
'post' => get_post()
|
||||
'post' => $post
|
||||
) );
|
||||
|
||||
// $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
|
||||
|
@ -1393,6 +1393,7 @@ function wp_enqueue_media( $args = array() ) {
|
||||
'nonce' => array(
|
||||
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
||||
),
|
||||
'postId' => 0,
|
||||
);
|
||||
|
||||
$post = null;
|
||||
|
Loading…
Reference in New Issue
Block a user