Opened 18 years ago
Closed 17 years ago
#6197 closed enhancement (fixed)
Add function for checking whether a script has already been added
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.8 | Priority: | lowest |
| Severity: | trivial | Version: | 2.5 |
| Component: | General | Keywords: | has-patch commit |
| Focuses: | 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);
}
Attachments (1)
Change History (11)
#3
@
18 years ago
- Keywords needs-patch added
- Milestone changed from 2.5 to 2.6
- Owner changed from anonymous to westi
- Status changed from new to assigned
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.
#4
@
17 years ago
- Keywords has-patch tested added; needs-patch removed
- Milestone changed from 2.9 to 2.8
Moving to 2.8 since it has a patch.
#6
@
17 years ago
- Keywords needs-testing removed
Shouldn't need testing since it is based on part off of the query in WP_Dependencies, so if there is a bug, then it is within WP_Dependencies::query().
#8
@
17 years ago
Yeah, is there a reason this hasn't been committed yet? I'll be willing to make the changes to get this committed.
Note: See
TracTickets for help on using
tickets.
The wp_scripts already has a method to determine if a script, exists, has been queued, or has been printed.
There's no procedural wrapper for it though.