From 1fb6abded88bb7f3f1f6b87e626800fd32ee34d6 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 19 Nov 2012 06:56:54 +0000 Subject: [PATCH] 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 --- wp-admin/includes/meta-boxes.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 932066c553..796efe7540 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -1030,7 +1030,7 @@ function post_thumbnail_meta_box( $post ) { }; $element.on( 'click', '.choose, img', function( event ) { - var options, thumbnailId; + var options, thumbnailId, attachment; event.preventDefault(); @@ -1047,8 +1047,11 @@ function post_thumbnail_meta_box( $post ) { }; thumbnailId = $thumbnailId.val(); - if ( '' !== thumbnailId && -1 !== thumbnailId ) - options.selection = [ Attachment.get( thumbnailId ) ]; + if ( '' !== thumbnailId && -1 !== thumbnailId ) { + attachment = Attachment.get( thumbnailId ); + attachment.fetch(); + options.selection = [ attachment ]; + } frame = wp.media( options );