[wp-trac] [WordPress Trac] #32093: Inconsistent class names between get_image_tag() and wp_get_image_attachment()

WordPress Trac noreply at wordpress.org
Fri Apr 24 02:40:05 UTC 2015


#32093: Inconsistent class names between get_image_tag() and
wp_get_image_attachment()
--------------------------+-----------------------------
 Reporter:  tychay        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `get_image_tag()` generates size class attribute as `size-[size]`, while
 `wp_get_attachment_image()` generates size class attribute as
 `attachment-[size]`.

 Since the former is called when inserting any image via
 `get_image_send_to_editor()`, while the latter is basically called when in
 plugins, post thumbnails, and the gallery shortcode, it would be best to
 settle on `size-[size]` as the likelihood of it breaking downstream code
 is smaller.

 '''However''' at this point there are a number of plugins and themes that
 try to modify post thumbnails and they will break if they hook off of it.
 (e.g a css class modifying `.attachment-thumbnails`, or the mobile
 minileven theme  in jetpack, also the site logo tool copies the improperly
 generated class.) So you may not want to fix this bug, or you may want to
 make the function generate both classes.

 To understand why this **is** a bug, for s--ts-and-giggles, try
 registering sizes that have the name "meta" in many themes (the wp-admin
 uses that class on divs in the upload and a number of themes like twenty
 thirteen have modeled themselves after it), or install the Isabelle theme
 and register and use sizes "caption" or "desc" (they'll get centered no
 matter what).

 Not sure it can be fixed at this point, but probably deserves a trac item
 so it can be searched for as a RESOLVED WONTFIX

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


More information about the wp-trac mailing list