[wp-trac] [WordPress Trac] #34981: Usage of `image_size_names_choose` breaks JS attachment model attributes

WordPress Trac noreply at wordpress.org
Fri Oct 21 15:32:03 UTC 2016


#34981: Usage of `image_size_names_choose` breaks JS attachment model attributes
-------------------------------------+------------------------
 Reporter:  dnaber-de                |       Owner:  joemcgill
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.7
Component:  Media                    |     Version:  4.3.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by joemcgill):

 There are ~60 plugins in the .org repo that are filtering on
 `image_size_names_choose` — overwhelmingly to add additional image sizes
 to the insert image dialogue, which is already applying the
 `image_size_names_choose` filter when the attachment-display-settings
 template is created in `wp_print_media_templates()`. I think we should be
 fine removing the filter from `wp_prepare_attachment_for_js()`.

 In [attachment:34981.4.diff], I've skipped the `image_size_names_choose`
 filter whenever we're returning sizes from the attachment metadata and am
 now only using it when we're looking to see if someone is setting sizes by
 filtering `image_downsize`. This allows all available image sizes to be
 returned by `wp_prepare_attachment_for_js()`. All Media, AJAX, and
 Customize tests are still passing.

 Regarding the unintended consequences in the media library whenever
 someone removes appropriate sizes, I agree that we should look into using
 `srcset` here, but we should also look at converting the media library to
 use the new JSON REST API endpoints instead of using admin-ajax.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34981#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list