Make WordPress Core

Ticket #20003: 20003.2.diff

File 20003.2.diff, 1.9 KB (added by ryan, 13 years ago)

Pass post id. Untested.

  • wp-admin/includes/ajax-actions.php

     
    15451545        }
    15461546
    15471547        if ( set_post_thumbnail( $post_ID, $thumbnail_id ) )
    1548                 wp_die( _wp_post_thumbnail_html( $thumbnail_id ) );
     1548                wp_die( _wp_post_thumbnail_html( $thumbnail_id, $post_ID ) );
    15491549        wp_die( 0 );
    15501550}
    15511551
  • wp-admin/includes/post.php

     
    11431143 * @since 2.9.0
    11441144 *
    11451145 * @param int $thumbnail_id ID of the attachment used for thumbnail
     1146 * @param int $post_id ID of the post associated with the thumbnail, defaults to global $post_ID
    11461147 * @return string html
    11471148 */
    1148 function _wp_post_thumbnail_html( $thumbnail_id = null ) {
     1149function _wp_post_thumbnail_html( $thumbnail_id = null, $post_id = null ) {
    11491150        global $content_width, $_wp_additional_image_sizes, $post_ID;
     1151
     1152        if ( empty( $post_id ) )
     1153                $post_id = $post_ID;
     1154
    11501155        $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>';
    11511156        $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
    11521157
     
    11581163                else
    11591164                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
    11601165                if ( !empty( $thumbnail_html ) ) {
    1161                         $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ID" );
     1166                        $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_id" );
    11621167                        $content = sprintf($set_thumbnail_link, $thumbnail_html);
    11631168                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
    11641169                }