WordPress.org

Make WordPress Core

Ticket #20003: 20003-patch.diff

File 20003-patch.diff, 1.7 KB (added by tott, 6 years ago)

Pass post_id to get_upload_iframe_src()

  • wp-admin/includes/post.php

     
    11521152        if ( empty( $post_id ) )
    11531153                $post_id = $post_ID;
    11541154
    1155         $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1155        $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image', $post_id) ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    11561156        $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
    11571157
    11581158        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
  • wp-admin/includes/media.php

     
    386386        return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='{$id}-add_{$type}' class='thickbox add_$type' title='" . esc_attr( $title ) . "'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
    387387}
    388388
    389 function get_upload_iframe_src( $type = null ) {
     389function get_upload_iframe_src( $type = null, $post_id = null ) {
    390390        global $post_ID;
    391391
    392         $uploading_iframe_ID = (int) $post_ID;
     392        if ( empty( $post_id ) )
     393                $post_id = $post_ID;
     394
     395        $uploading_iframe_ID = (int) $post_id;
    393396        $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, admin_url('media-upload.php') );
    394397
    395398        if ( $type && 'media' != $type )