From 8a3607998cb5cbb7a7bd804c5aac0f3284512005 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 10 Dec 2009 07:04:01 +0000 Subject: [PATCH] Do not show "Use as thumbnail" in standalone media browser, but DO show it when you upload a new image on a post. fixes #11366 git-svn-id: http://svn.automattic.com/wordpress/trunk@12352 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e6277f174c..4b9e41330d 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1239,7 +1239,12 @@ function get_media_item( $attachment_id, $args = null ) { } $thumbnail = ''; - if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-thumbnails', get_post_type($_GET['post_id']) ) && get_post_thumbnail_id($_GET['post_id']) != $attachment_id ) + $calling_post_id = 0; + if ( isset( $_GET['post_id'] ) ) + $calling_post_id = $_GET['post_id']; + elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set + $calling_post_id = $post->post_parent; + if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) $thumbnail = "" . esc_html__( "Use as thumbnail" ) . ""; if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) )