[wp-trac] [WordPress Trac] #62731: Inline CSS inserted by wp_print_auto_sizes_contain_css_fix too high in HTML

WordPress Trac noreply at wordpress.org
Wed Jun 11 01:05:09 UTC 2025


#62731: Inline CSS inserted by wp_print_auto_sizes_contain_css_fix too high in HTML
---------------------------------------------------+---------------------
 Reporter:  superpoincare                          |       Owner:  (none)
     Type:  enhancement                            |      Status:  new
 Priority:  normal                                 |   Milestone:  6.9
Component:  Media                                  |     Version:  6.7.1
 Severity:  minor                                  |  Resolution:
 Keywords:  has-patch needs-testing has-test-info  |     Focuses:
---------------------------------------------------+---------------------

Comment (by joemcgill):

 Replying to [comment:5 westonruter]:

 > @joemcgill @flixos90 Any specific reason for why the style was manually
 printed at `wp_head`?

 From my memory, there is no technical reason why that CSS rule needs to be
 output as early or directly as it is currently. It was mainly done that
 way as the most direct fix in 6.7.1 to address #62413. I would welcome a
 more robust enqueueing solution now as long as it doesn't result in a
 blocking request (which is not a concern with what is being proposed).

 I don't know that there is much value in changing the function name, which
 then requires the deprecation, but am not opposed if there is a good
 reason for that change as well.

 The main back-compat issue I would be concerned about is if someone has
 forcibly removed this CSS by doing something like:


 {{{#!php
 remove_action( 'wp_head', 'wp_print_auto_sizes_contain_css_fix', 1 );
 }}}

 I would strongly recommend against anyone using that strategy, since it
 could result in auto sized images being distorted (disabling the auto-
 sizes feature entirely would be better, using the
 `wp_img_tag_add_auto_sizes` filter), but it is possible that someone is
 doing this and the change proposed in [https://github.com/WordPress
 /wordpress-develop/pull/8954 PR#8954] would cause that CSS to be added
 again.

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


More information about the wp-trac mailing list