WP_Styles::_css_href() WordPress Method

The WP_Styles::_css_href() method is used to retrieve the URL of a CSS stylesheet. This is useful for retrieving the URL of a stylesheet that is required by a plugin or theme.

WP_Styles::_css_href( string $src, string $ver, string $handle ) #

Generates an enqueued style’s fully-qualified URL.


Parameters

$src

(string)(Required)The source of the enqueued style.

$ver

(string)(Required)The version of the enqueued style.

$handle

(string)(Required)The style's registered handle.


Top ↑

Return

(string) Style's fully-qualified URL.


Top ↑

Source

File: wp-includes/class.wp-styles.php

	public function _css_href( $src, $ver, $handle ) {
		if ( ! is_bool( $src ) && ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) {
			$src = $this->base_url . $src;
		}

		if ( ! empty( $ver ) ) {
			$src = add_query_arg( 'ver', $ver, $src );
		}

		/**
		 * Filters an enqueued style's fully-qualified URL.
		 *
		 * @since 2.6.0
		 *
		 * @param string $src    The source URL of the enqueued style.
		 * @param string $handle The style's registered handle.
		 */
		$src = apply_filters( 'style_loader_src', $src, $handle );
		return esc_url( $src );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.