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:
parent
c1e9ddd316
commit
5b94b6b43e
|
@ -383,8 +383,12 @@ document.body.className = document.body.className.replace('no-js', 'js');
|
||||||
* @param string $editor_id
|
* @param string $editor_id
|
||||||
*/
|
*/
|
||||||
function media_buttons($editor_id = 'content') {
|
function media_buttons($editor_id = 'content') {
|
||||||
|
$post = get_post();
|
||||||
|
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
|
||||||
|
$post = $GLOBALS['post_ID'];
|
||||||
|
|
||||||
wp_enqueue_media( array(
|
wp_enqueue_media( array(
|
||||||
'post' => get_post()
|
'post' => $post
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
|
// $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
|
||||||
|
|
|
@ -1393,6 +1393,7 @@ function wp_enqueue_media( $args = array() ) {
|
||||||
'nonce' => array(
|
'nonce' => array(
|
||||||
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
||||||
),
|
),
|
||||||
|
'postId' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
$post = null;
|
$post = null;
|
||||||
|
|
Loading…
Reference in New Issue