style_loader_tag
Filters the HTML link tag of an enqueued style.
Usage
add_filter( 'style_loader_tag', 'wp_kama_style_loader_tag_filter', 10, 4 );
/**
* Function for `style_loader_tag` filter-hook.
*
* @param string $tag The link tag for the enqueued style.
* @param string $handle The style's registered handle.
* @param string $href The stylesheet's source URL.
* @param string $media The stylesheet's media attribute.
*
* @return string
*/
function wp_kama_style_loader_tag_filter( $tag, $handle, $href, $media ){
// filter...
return $tag;
}
- $tag(string)
- The link tag for the enqueued style.
- $handle(string)
- The style's registered handle.
- $href(string)
- The stylesheet's source URL.
- $media(string)
- The stylesheet's media attribute.
Changelog
| Since 2.6.0 | Introduced. |
| Since 4.3.0 | Introduced the $href parameter. |
| Since 4.5.0 | Introduced the $media parameter. |
Where the hook is called
style_loader_tag
wp-includes/class-wp-styles.php 225
$tag = apply_filters( 'style_loader_tag', $tag, $handle, $href, $media );
wp-includes/class-wp-styles.php 245
$rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media );