From f42a7852c2211bc715ebe9f9a37930b3308509bc Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@19256 602fd350-edb4-49c9-b593-d223f7449a82 --- 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" ) . ""; }