[wp-trac] [WordPress Trac] #42863: Wrong default-value for $size in get_the_post_thumbnail_url()

WordPress Trac noreply at wordpress.org
Mon Dec 11 01:05:18 UTC 2017


#42863: Wrong default-value for $size in get_the_post_thumbnail_url()
-----------------------------+-----------------------------
 Reporter:  souri_wpaustria  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Media            |    Version:  4.9.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 If you use get_the_post_thumbnail_url() without setting the $size value,
 it seems that get_the_post_thumbnail_url() doesn't work!

 Look here:
  get_the_post_thumbnail_url()
 * https://github.com/WordPress/WordPress/blob/master/wp-includes/post-
 thumbnail-template.php#L196
 * default for $size = post-thumbnail

  wp_get_attachment_image_url()
 * https://github.com/WordPress/WordPress/blob/master/wp-
 includes/media.php#L944
 * default for $size = thumbnail

 So if you want to use get_the_post_thumbnail_url() correctly, you have to
 specify $size = 'thumbnail'. Otherwise it doesn't work, because the
 default is "post_thumbnail" and this is meh.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42863>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list