Opened 18 years ago
Closed 18 years ago
#6197 closed enhancement (fixed)
Add function for checking whether a script has already been added
| Reported by: | Denis-de-Bernardy | Owned by: | westi |
|---|---|---|---|
| Priority: | lowest | Milestone: | 2.8 |
| Component: | General | Version: | 2.5 |
| Severity: | trivial | Keywords: | has-patch commit |
| Cc: | Focuses: |
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 2.5 → 2.6
- Owner changed from to
- Status new → 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
@
18 years ago
- Keywords has-patch tested added; needs-patch removed
- Milestone 2.9 → 2.8
Moving to 2.8 since it has a patch.
#6
@
18 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
@
18 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.