wppaste
WordPress

apply_filters( 'style_loader_tag', string $tag, string $handle, string $href, string $media )

Since
2.6.0, 4.3.0, 4.5.0
Filters the HTML link tag of an enqueued style.

Compatibility

WordPress
since 4.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$tagstring
The link tag for the enqueued style.
$handlestring
The style's registered handle.
$hrefstring
The stylesheet's source URL.
$mediastring
The stylesheet's media attribute.

Where this hook fires · 2

  • wp-includes/class-wp-styles.php:251WP_Styles::do_item()
  • wp-includes/class-wp-styles.php:272WP_Styles::do_item()

Source code

<?php		 *		 * @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.		 */		$tag = apply_filters( 'style_loader_tag', $tag, $handle, $href, $media ); 		if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) {			if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {				$suffix   = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';				$rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $src, $ver, "$handle-rtl" ) );			} else {

Changelog

Introduced in 4.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.5.0
Introduced the $media parameter.from the docblock
4.3.0
Introduced the $href parameter.from the docblock
2.6.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.