[wp-trac] [WordPress Trac] #24815: get_the_post_thumbnail() fetches full sized image if 'post-thumbnail' custom size not defined in theme

WordPress Trac noreply at wordpress.org
Mon Jul 22 09:43:42 UTC 2013


#24815: get_the_post_thumbnail() fetches full sized image if 'post-thumbnail'
custom size not defined in theme
--------------------------+-----------------------------------------------
 Reporter:  Jonnyauk      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch needs-codex 2nd-opinion
--------------------------+-----------------------------------------------
 In wp-includes/post-thumbnail-template.php the $size default value is set
 as 'post-thumbnail' in the following function:

 - get_the_post_thumbnail()

 '''Expected behaviour'''
 Expected behaviour would be to return the image at 'post-thumbnail'
 dimensions - however, if this is not set in the theme via:

 - set_post_thumbnail_size() function
 - add_image_size() function

 it returns the full sized sized image begin displayed. I'd expect this to
 return the image at standard 'thumbnail' size, as some people will just
 add add_theme_support( 'post-thumbnails' ) and not set (or even need)
 custom dimensions.

 '''Proposal and patch'''
 $size default value should default back to 'thumbnail' for normal expected
 function behaviour if 'post-thumbnail' specific dimensions have not been
 set.

 I'm not sure if it would be more efficient to test against the global
 variable that holds these values, or use get_intermediate_image_sizes() as
 I've used in the patch attached - 2nd opinion please?

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24815>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list