#54314 closed enhancement (duplicate)
Can not add script attribute with wp_enqueue_script()
Reported by: | emrancu | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
There is no option to add custom attributes to the script tag.
I need to add a type attribute to the script tag but no way.
Change History (5)
This ticket was mentioned in PR #1775 on WordPress/wordpress-develop by emrancu.
3 years ago
#1
- Keywords has-patch added
#2
@
3 years ago
Need to add following attributes:
- type
- async
- crossorigin
- defer
- integrity
- nonce
- referrerpolicy
Version 0, edited 3 years ago
by
(next)
#4
@
3 years ago
- Component changed from General to Script Loader
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from assigned to closed
Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch.
As noted above, we're already tracking this enhancement in #22249, let's continue the discussion there.
Note: See
TracTickets for help on using
tickets.
There is not option for setting script attributes ( like 'async', 'crossorigin', 'defer', 'integrity', 'nonce', 'referrerpolicy', 'type' ).
I have added support to add custom attribute/s to script tag with the wp_enqueue_script method.
Trac ticket: https://core.trac.wordpress.org/ticket/54314