From 61fca356912eab4b8fc62965e4e925c68b76fb1a Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 11 Nov 2011 19:38:34 +0000 Subject: [PATCH] Don't show 'Use as featured image' in the image insert dialog if the post type does not support thumbnails. Props SergeyBiryukov. fixes #18669 git-svn-id: http://svn.automattic.com/wordpress/trunk@19256 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 9c2018107d..220a994bab 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1160,7 +1160,8 @@ function get_media_item( $attachment_id, $args = null ) { $calling_post_id = absint( $_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 ) { + if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) + && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); $thumbnail = "" . esc_html__( "Use as featured image" ) . ""; }