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:
Ryan Boren 2012-11-26 22:03:37 +00:00
parent 390e1756a1
commit 7ce1968d15
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;