function wp_enqueue_style( $handle, $src = false, $deps = array() {}

Enqueue a CSS style file.
Registers the style if src provided (does NOT overwrite) and enqueues.


  • string $handle: Name of the stylesheet.
  • string|bool $src: Path to the stylesheet from the root directory of WordPress. Example: ‘/css/mystyle.css’.
  • array $deps: Array of handles (names) of any stylesheet that this stylesheet depends on. (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
  • string|bool $ver: String specifying the stylesheet version number, if it has one. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the stylesheet.
  • string $media: The media for which this stylesheet has been defined.

Source code

function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {

	global $wp_styles;

	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {

		if ( ! did_action( 'init' ) )

			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),

				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );

		$wp_styles = new WP_Styles();


	if ( $src ) {

		$_handle = explode('?', $handle);

		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );


	$wp_styles->enqueue( $handle );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: