[wp-trac] [WordPress Trac] #58775: Remove usage of outputting styles tags

WordPress Trac noreply at wordpress.org
Mon Sep 25 19:07:38 UTC 2023


#58775: Remove usage of outputting styles tags
--------------------------------+---------------------------
 Reporter:  spacedmonkey        |       Owner:  spacedmonkey
     Type:  enhancement         |      Status:  reopened
 Priority:  normal              |   Milestone:  6.4
Component:  Script Loader       |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  2nd-opinion revert  |     Focuses:  performance
--------------------------------+---------------------------

Comment (by azaozz):

 Replying to [comment:24 spacedmonkey]:
 > Committed in https://github.com/WordPress/wordpress-
 develop/commit/54c4de13edfaf3b9fbc1b67d6ba384618614d59e

 The commit is [56682]. Full text of the commit message:

 {{{
 In this commit, enhancements have been made by replacing manually
 constructed style tags with calls to wp_add_inline_style.
 Previously, numerous style tags were generated and output directly
 in the header, resulting in redundant code and bypassing the
 core's style enqueueing system. This approach made it challenging
 for third-party developers to manage and control the output of
 these style tags.

 To ensure backward compatibility, the following functions have been
 deprecated and replaced:

     print_embed_styles
     print_emoji_styles
     wp_admin_bar_header
     _admin_bar_bump_cb

 Backward compatibility shims have also been added, ensuring that
 if these functions were previously unhooked from there actions,
 they will continue to not output a style tag.

 However, for the following functions, conversion to use inline
 styles was not feasible due to the potential disruption it
 might cause by changing the style tag IDs, potentially breaking
 JavaScript functionality for a number of plugins in the repository:

     custom-background
     wp-custom

 These changes improve code maintainability and enhance the flexibility
 and control available to developers when managing style outputs
 within WordPress core.

 Props spacedmonkey, hlunter, westonruter, flixos90.
 Fixes #58775.
 }}}

 @spacedmonkey In the future could you please use Trac references? Makes it
 a lot easier to follow.

 The part of the commit message that doesn't match the previous comments
 is:

 > ...bypassing the core's style enqueueing system. This approach made it
 challenging for third-party developers to manage and control the output of
 these style tags.

 Couple things about that:

 1. This is not true. As pointed numerous times it is a bad idea for
 extenders to remove default WP styles. So "manage and control" is actually
 "doing-it-wrong" here.

 2. In a previous comment @flixos90 insisted that allowing extenders to
 "manage and control" these styles (by replacing or removing them) is not
 the purpose of this change. So, which is true and which is not?

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


More information about the wp-trac mailing list