WordPress at a glance

wp_script_is() WP 1.0

Check whether a script has been added to the queue.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

  • Since 3.5.0 'enqueued' added as an alias of the 'queue' list.
✈ 1 time = 0.000026s = very fast | 50000 times = 0.09s = speed of light | PHP 7.0.5, WP 4.5.2

No Hooks.

Return

true/false. Whether the script is queued.

Usage

wp_script_is( $handle, $list );
$handle(string) (required)
Name of the script.
$list(string)
Status of the script to check. Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
Default: 'enqueued'

Code of wp_script_is: wp-includes/functions.wp-scripts.php VER 5.0.1

<?php
function wp_script_is( $handle, $list = 'enqueued' ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );

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

Related Functions

From tag: script

More from tag: Conditional tags (all)

More from category: Scripts and Styles

No comments
    Hello, !     Log In . Register