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: http://core.svn.wordpress.org/trunk@22846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-11-26 22:03:37 +00:00
parent c1e9ddd316
commit 5b94b6b43e
2 changed files with 6 additions and 1 deletions

View File

@ -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'));

View File

@ -1393,6 +1393,7 @@ function wp_enqueue_media( $args = array() ) {
'nonce' => array(
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
),
'postId' => 0,
);
$post = null;