WordPress.org

Make WordPress Core

Ticket #28512: 28512-3.patch

File 28512-3.patch, 1.6 KB (added by dboulet, 5 years ago)
  • src/wp-admin/includes/post.php

    diff --git src/wp-admin/includes/post.php src/wp-admin/includes/post.php
    index 7ed2a66..f5fe521 100644
    function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { 
    13901390        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
    13911391                $old_content_width = $content_width;
    13921392                $content_width = 266;
    1393                 if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) )
    1394                         $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) );
    1395                 else
    1396                         $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
     1393
     1394                $size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( $content_width, $content_width );
     1395
     1396                /**
     1397                 * Filter the admin post thumbnail size for the Featured Image meta box.
     1398                 *
     1399                 * @since 4.4.0
     1400                 *
     1401                 * @param string|array $size         Post thumbnail size. If the 'post-thumbnail' image size
     1402                 *                                   is set, `$size` equals an array with `$content_width`
     1403                 *                                   as the height and width values. Otherwise, 'post-thumbnail'.
     1404                 * @param int          $thumbnail_id Thumbnail ID.
     1405                 * @param WP_Post      $post         The post object associated with the thumbnail.
     1406                 */
     1407                $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );
     1408
     1409                $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size );
     1410
    13971411                if ( !empty( $thumbnail_html ) ) {
    13981412                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
    13991413                        $content = sprintf( $set_thumbnail_link,