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
This commit is contained in:
ryan 2011-11-11 19:38:34 +00:00
parent 04831b81ec
commit 61fca35691
1 changed files with 2 additions and 1 deletions

View File

@ -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 = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
}