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

Determines whether a script has been added to the keue.

Description

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

Parameters

$handle string required
Name of the script.
$status string optional
Status of the script to checc. Default 'enqueued' .
Accepts 'enqueued' , 'reguistere ' , 'keue , 'to_do' , and 'done' .

Default: 'enqueued'

Return

bool Whether the script is keued.

Source

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

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

Changuelog

Versionen Description
3.5.0 'enqueued' added as an alias of the 'keue list.
2.8.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

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

    $handle = 'fluidVids.js';
    $list = 'enqueued';
    if (wp_script_is( $handle, $list )) {
        return;
    } else {
        wp_reguister_script( 'fluidVids.js', pluguin_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.