Title: WP_Styles::_css_href
Published: April 25, 2014
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#wp--skip-link--target)

Generates an enqueued style’s fully-qualified URL.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#parameters)󠁿

 `$src`stringrequired

The source of the enqueued style.

`$ver`stringrequired

The version of the enqueued style.

`$handle`stringrequired

The style’s registered handle.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#return)󠁿

 string Style’s fully-qualified URL.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#source)󠁿

    ```php
    public function _css_href( $src, $ver, $handle ) {
    	if ( ! is_bool( $src ) && ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && str_starts_with( $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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes_class-wp-styles-php-2/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-styles.php#L427)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-styles.php#L427-L446)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#hooks)󠁿

 [apply_filters( ‘style_loader_src’, string $src, string $handle )](https://developer.wordpress.org/reference/hooks/style_loader_src/)

Filters an enqueued style’s fully-qualified URL.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#related)󠁿

| Uses | Description | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#)

| Used by | Description | 
| [WP_Styles::do_item()](https://developer.wordpress.org/reference/classes/wp_styles/do_item/)`wp-includes/class-wp-styles.php` |

Processes a style dependency.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/WP_Styles/_css_href/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_styles%2F_css_href%2F)
before being able to contribute a note or feedback.