Opened 10 years ago
Closed 9 years ago
#33922 closed defect (bug) (duplicate)
login_enqueue_scripts and head placement
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | needs-testing has-patch |
Focuses: | Cc: |
Description
According to the codex for the correct method is to enqueue the style with wp_enqueue_style linked to the login_enqueue_script action: https://codex.wordpress.org/Plugin_API/Action_Reference/login_enqueue_scripts
However this places the style in the body of the page just above the body tag. This is fine if you're queuing up a block of inline style, but not for a link element. Any styles won't be parsed until the page is loaded and any overriding css elements will cause jerky refresh issues.
If you're recommending this hook for login page scripts it needs a way to either differentiate the enqueued style i.e. link attr, or an argument such as for wp_enquque_scripts where in this case placement in the header is forced with a TRUE parameter.
There is a workaround as this stack exchange query details: http://wordpress.stackexchange.com/questions/127835/enqueue-a-stylesheet-for-login-page-and-make-it-appear-in-head-element
Thanks.
Attachments (1)
Change History (5)
#2
@
10 years ago
- Component changed from Login and Registration to Script Loader
- Keywords needs-patch needs-testing added
- Milestone changed from Awaiting Review to Future Release
- Type changed from enhancement to defect (bug)
- Version trunk deleted
#3
@
9 years ago
- Keywords has-patch added; needs-patch removed
Explanation:
The print_late_styles()
function was the only way styles were being printed to the login page. This meant that the queued items for the header were still in the queue as the queue hadn't been flushed yet. Adding a call to wp_print_styles()
at login_head
allows the head-specific styles to be flushed at the correct time.
Confirmed. Enqueuing scripts on this hook works as expected, but enqueuing styles results in the
<link>
tag being output in the footer.