wp_script_is

Check whether a script has been added to the queue.

Description

wp_script_is( (string) $handle, (string) $list = 'enqueued' ); 

Parameters (2)

0. $handle (string)
Name of the script.
1. $list — Optional. (string) => 'enqueued'
Status of the script to check. Default enqueued.. Accepts enqueued., registered,, queue, to_do, and done.

Usage

  1. if ( !function_exists( 'wp_script_is' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.wp-scripts.php'; 
  3.  
  4. // Name of the script. 
  5. $handle = ''; 
  6.  
  7. // Optional. Status of the script to check. Default 'enqueued'. 
  8. // Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. 
  9. $list = 'enqueued'; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = wp_script_is($handle, $list); 
  13.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.wp-scripts.php  
  1. function wp_script_is( $handle, $list = 'enqueued' ) { 
  2.  
  3. return (bool)wp_scripts)->query( $handle, $list );