Determines whether a script has been added to the queue.
Description
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Parameters
$handle
stringrequired- Name of the script.
$status
stringoptional- Status of the script to check. Default
'enqueued'
.
Accepts'enqueued'
,'registered'
,'queue'
,'to_do'
, and'done'
.Default:
'enqueued'
Source
function wp_script_is( $handle, $status = 'enqueued' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return (bool) wp_scripts()->query( $handle, $status );
}
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.