Ticket #6197 (assigned enhancement)

Opened 4 months ago

Last modified 4 months ago

extra scripts function suggestion

Reported by: Denis-de-Bernardy Assigned to: westi (accepted)
Priority: lowest Milestone: 2.6
Component: General Version: 2.5
Severity: trivial Keywords: needs-patch
Cc:

Description

a wp_is_enqueued_script($handle) function could be useful... something like:

function wp_is_enqueued_script($handle)
{
  global $wp_scripts;
  if ( !is_object($wp_scripts) )
    return false;
  else
    return in_array($handle, (array) $wp_scripts->queue);
}

Change History

03/13/08 18:13:05 changed by mdawaffe

The wp_scripts already has a method to determine if a script, exists, has been queued, or has been printed.

global $wp_scripts;
return $wp_scripts->query( $handle, 'queue' ); // 'scripts', 'queue', or 'printed'

There's no procedural wrapper for it though.

03/13/08 23:28:49 changed by Denis-de-Bernardy

  • priority changed from normal to lowest.

works for me... :)

03/14/08 18:55:33 changed by westi

  • keywords set to needs-patch.
  • owner changed from anonymous to westi.
  • status changed from new to assigned.
  • milestone changed from 2.5 to 2.6.

Good idea - moving to 2.6 as we are in feature freeze and you can access the info easily if not via a wrapper function.