wp_script_is( string $handle, string $status = 'enqueued' ): bool

Determines 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.

Top ↑


$handle string Required
Name of the script.
$status string Optional
Status of the script to check. Default 'enqueued'.
Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.

Default: 'enqueued'

Top ↑


bool Whether the script is queued.

Top ↑


File: wp-includes/functions.wp-scripts.php. View all references

function wp_script_is( $handle, $status = 'enqueued' ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

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

Top ↑


Version Description
3.5.0 'enqueued' added as an alias of the 'queue' list.
2.8.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Codex

    Basic Example
    This would check if the script named ‘fluidVids.js’ is enqueued. If it is enqueued, it does nothing. If it is not enqueued, the files are then registered and enqueued.

    $handle = 'fluidVids.js';
    $list = 'enqueued';
    if (wp_script_is( $handle, $list )) {
    } else {
        wp_register_script( 'fluidVids.js', plugin_dir_url(__FILE__).'js/fluidvids.min.js');
        wp_enqueue_script( 'fluidVids.js' );

You must log in before being able to contribute a note or feedback.