WordPress.org

Make WordPress Core

Changeset 22846


Ignore:
Timestamp:
11/26/2012 10:03:37 PM (8 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r22828 r22846  
    384384 */
    385385function media_buttons($editor_id = 'content') {
     386    $post = get_post();
     387    if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
     388        $post = $GLOBALS['post_ID'];
     389
    386390    wp_enqueue_media( array(
    387         'post' => get_post()
     391        'post' => $post
    388392    ) );
    389393
  • trunk/wp-includes/media.php

    r22832 r22846  
    13941394            'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
    13951395        ),
     1396        'postId'    => 0,
    13961397    );
    13971398
Note: See TracChangeset for help on using the changeset viewer.