WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 3 months ago

#39270 closed defect (bug) (fixed)

Use a higher priority on wp_head for inline custom CSS

Reported by: jeremyfelt Owned by: westonruter
Milestone: 4.7.1 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch commit fixed-major
Focuses: Cc:

Description

As of [38829], via #35395, custom CSS is output inline on wp_head with a priority of 11.

Other themes, well at least one, may also use priority 11 to output inline CSS for the same reasoning as our commit message - "so that it overrides any enqueued stylesheets". Because of the order in which these are added, the "overriding" custom CSS from WordPress it output before the additional theme styles.

The Jetpack solution, before WP 4.7, was to use priority 101 so that the styles were more likely to output last.

Because of the priority shifting/confusion, the upgrade to WordPress 4.7 caused visual regressions on the front end for at least 2 sites that I'm aware of.

If it's not too late, I'd like to suggest bumping this priority to something that fires even later, say 99.

Attachments (1)

39270.0.diff (938 bytes) - added by westonruter 3 months ago.

Download all attachments as: .zip

Change History (12)

#1 @jeremyfelt
4 months ago

  • Milestone changed from Awaiting Review to 4.7.1

I'm going to bump this to 4.7.1 for consideration. If it's not handled there, then it may be too much of a breaking change to handle in 4.8 or later.

#2 @westonruter
3 months ago

  • Owner set to westonruter
  • Status changed from new to accepted

I agree it should be changed sooner than later. Following Jetpack's lead on the priority is probably the way to go.

@westonruter
3 months ago

#3 @westonruter
3 months ago

  • Keywords has-patch commit added

#4 @westonruter
3 months ago

@jeremyfelt any reason to not re-use Jetpack's 101 priority?

/cc @georgestephanis

#5 @jeremyfelt
3 months ago

No objection here. Makes for a very clean diff :)

#6 @westonruter
3 months ago

@georgestephanis I'll commit once we get your 👍

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


3 months ago

#8 @georgestephanis
3 months ago

+1, looks good. I think @jeherve said we've had some remarks from users as well. Good change.

#9 @westonruter
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 39616:

Customize: Bump wp_custom_css_cb from running at wp_head priority 11 to 101 to ensure Custom CSS overrides other CSS.

Aligns wp_head action priority with Jetpack's Custom CSS.

Amends [38829].
See #35395, #38672.
Fixes #39270.

#10 @westonruter
3 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for 4.7.1

#11 @dd32
3 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 39651:

Customize: Bump wp_custom_css_cb from running at wp_head priority 11 to 101 to ensure Custom CSS overrides other CSS.

Aligns wp_head action priority with Jetpack's Custom CSS.

Amends [38829].
See #35395, #38672.
Merges [39616] to the 4.7 branch.
Fixes #39270.

Note: See TracTickets for help on using tickets.