Make WordPress Core

Ticket #28512: 28512-2.diff

File 28512-2.diff, 1.6 KB (added by dboulet, 10 years ago)
  • src/wp-admin/includes/post.php

    diff --git src/wp-admin/includes/post.php src/wp-admin/includes/post.php
    index 1968e96..bebdfcf 100644
    function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { 
    13761376        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
    13771377                $old_content_width = $content_width;
    13781378                $content_width = 266;
    1379                 if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) )
    1380                         $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) );
    1381                 else
    1382                         $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
     1379
     1380                $size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( $content_width, $content_width );
     1381
     1382                /**
     1383                 * Filter the admin post thumbnail size for the Featured Image meta box.
     1384                 *
     1385                 * @since 4.3.0
     1386                 *
     1387                 * @param string|array $size         Post thumbnail size. If the 'post-thumbnail' image size
     1388                 *                                   is set, `$size` equals an array with `$content_width`
     1389                 *                                   as the height and width values. Otherwise, 'post-thumbnail'.
     1390                 * @param int          $thumbnail_id Thumbnail ID.
     1391                 * @param WP_Post      $post         The post object associated with the thumbnail.
     1392                 */
     1393                $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );
     1394
     1395                $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size );
     1396
    13831397                if ( !empty( $thumbnail_html ) ) {
    13841398                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
    13851399                        $content = sprintf( $set_thumbnail_link,