diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 83756e695a..f5f6234994 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1396,10 +1396,31 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $old_content_width = $content_width; $content_width = 266; - if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) ) - $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) ); - else - $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' ); + + $size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( $content_width, $content_width ); + + /** + * Filter the size used to display the post thumbnail image in the 'Featured Image' meta box. + * + * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' + * image size is registered, which differs from the 'thumbnail' image size + * managed via the Settings > Media screen. See the `$size` parameter description + * for more information on default values. + * + * @since 4.4.0 + * + * @param string|array $size Post thumbnail image size to display in the meta box. Accepts + * any valid image size, or an array of height and width values. + * If the 'post-thumbnail' size is set, default is 'post-thumbnail'. + * Otherwise, default is an array with `$content_width` as the + * height and width values. + * @param int $thumbnail_id Post thumbnail attachment ID. + * @param WP_Post $post The post object associated with the thumbnail. + */ + $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post ); + + $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size ); + if ( !empty( $thumbnail_html ) ) { $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID ); $content = sprintf( $set_thumbnail_link, diff --git a/wp-includes/version.php b/wp-includes/version.php index 60d541f04c..59e59e31c1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35021'; +$wp_version = '4.4-alpha-35022'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.