[wp-trac] [WordPress Trac] #50160: Enable captions for image widgets with custom image size

WordPress Trac noreply at wordpress.org
Wed May 13 21:56:33 UTC 2020


#50160: Enable captions for image widgets with custom image size
--------------------------+-----------------------------
 Reporter:  kasparsd      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  5.4.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Image widgets with image size set to "custom" and custom width and height
 values do not render captions on the widget output.

 This happens because `_wp_get_image_size_from_meta()` with `custom` as the
 first parameter returns `false`
 [https://github.com/WordPress/WordPress/blob/a94ed9baf35091ca659bd0719424ed809cdc6f6f
 /wp-includes/widgets/class-wp-widget-media-image.php#L218 here] and sets
 the `$caption_size` value to `false` which in turn causes `$width` to be
 `0` which then disables caption output during `img_caption_shortcode()`
 [https://github.com/WordPress/WordPress/blob/f89f744fb208640686a465c91992fd97b2bceef9
 /wp-includes/media.php#L1890-L1892 here].

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


More information about the wp-trac mailing list