get_the_post_thumbnail() fetches full sized image if 'post-thumbnail' custom size not defined in theme
|Reported by:||Jonnyauk||Owned by:|
|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:
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?