mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
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:
parent
04831b81ec
commit
61fca35691
@ -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>";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user