wp_style_is() WordPress Function

The wp_style_is() function allows you to check if a particular style is currently loaded. This is useful for conditionally loading stylesheets.

wp_style_is( string $handle, string $list = 'enqueued' ) #

Check whether a CSS stylesheet has been added to the queue.


Parameters

$handle

(string)(Required)Name of the stylesheet.

$list

(string)(Optional) Status of the stylesheet to check. Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.

Default value: 'enqueued'


Top ↑

Return

(bool) Whether style is queued.


Top ↑

Source

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

function wp_style_is( $handle, $list = 'enqueued' ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	return (bool) wp_styles()->query( $handle, $list );
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.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.