Opened 9 years ago
Closed 9 years ago
#37317 closed defect (bug) (fixed)
Change priority of `wp_resource_hints()` to print them earlier
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.6 | Priority: | normal |
| Severity: | normal | Version: | 4.6 |
| Component: | General | Keywords: | has-patch commit |
| Focuses: | performance | Cc: |
Description
As noted in https://wordpress.org/support/topic/ordering-of-dns-prefetch-preconnect?replies=2, the resource hints should be printed before scripts and styles are returned.
The current priority is 10 for wp_head and for the admin we're using admin_head which runs after admin_print_scripts. We can lower the priority to 1 for the front end and should change the admin hook to admin_print_styles.
Attachments (3)
Change History (13)
#4
follow-up:
↓ 5
@
9 years ago
- Keywords needs-refresh added
In 37317.2.diff customizer outputs the hints twice, above DOCTYPE declaration.
Additional thoughts
- On
wp_headsetting the priority to2seems a surer way of ensuring it follows the enqueue action. - Using
1000as a magic number foradmin_enqueue_scriptsdoesn't thrill me, a low number onadmin_print_scriptsseems more likely to get the desired result.
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
9 years ago
Replying to peterwilsoncc:
- Using
1000as a magic number foradmin_enqueue_scriptsdoesn't thrill me, a low number onadmin_print_scriptsseems more likely to get the desired result.
Did you mean admin_print_styles here? Because admin_print_scripts runs after styles are printed.
#6
in reply to:
↑ 5
@
9 years ago
Replying to ocean90:
Did you mean
admin_print_styleshere? Becauseadmin_print_scriptsruns after styles are printed.
I did, yes.
#7
@
9 years ago
37317.3.diff uses customize_controls_print_styles and admin_print_styles with a ! is_customize_preview() condition to prevent adding hints twice to the customizer.
Discovered a few more things: