Skip to content

Commit 1fb6abd

Browse files
author
Daryl Koopersmith
committed
Media: Properly display selected featured image data if the featured image is not in the first section of the library. see #22494, #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22667 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1b42cd4 commit 1fb6abd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

wp-admin/includes/meta-boxes.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ function post_thumbnail_meta_box( $post ) {
10301030
};
10311031

10321032
$element.on( 'click', '.choose, img', function( event ) {
1033-
var options, thumbnailId;
1033+
var options, thumbnailId, attachment;
10341034

10351035
event.preventDefault();
10361036

@@ -1047,8 +1047,11 @@ function post_thumbnail_meta_box( $post ) {
10471047
};
10481048

10491049
thumbnailId = $thumbnailId.val();
1050-
if ( '' !== thumbnailId && -1 !== thumbnailId )
1051-
options.selection = [ Attachment.get( thumbnailId ) ];
1050+
if ( '' !== thumbnailId && -1 !== thumbnailId ) {
1051+
attachment = Attachment.get( thumbnailId );
1052+
attachment.fetch();
1053+
options.selection = [ attachment ];
1054+
}
10521055

10531056
frame = wp.media( options );
10541057

0 commit comments

Comments
 (0)