diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index c81d495248..21b5522768 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -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')); diff --git a/wp-includes/media.php b/wp-includes/media.php index b91fab5d0c..005f863e51 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1393,6 +1393,7 @@ function wp_enqueue_media( $args = array() ) { 'nonce' => array( 'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ), ), + 'postId' => 0, ); $post = null;