#22245 closed feature request (duplicate)
Add Hook: "script_loader_tag"
| Reported by: | ryanve | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
There exists a filter for "style_loader_tag" in wp-includes/class.wp-styles.php. A corresponding filter "script_loader_tag" in wp-includes/class.wp-scripts.php would be very useful for customizing script loading.
Change History (5)
#2
@
14 years ago
add_filter( 'script_loader_tag', function ( $html, $handle ) {
if ( 'example' !== $handle )
return $html;
return str_replace( '<script ', '<script async ', $html );
}, 12, 2);
#3
@
14 years ago
- Component Formatting → General
- Keywords dev-feedback needs-patch removed
- Milestone Awaiting Review
- Resolution → duplicate
- Status new → closed
Duplicate of #13592.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Example use case?