Opened 11 years ago
Closed 11 years ago
#28404 closed defect (bug) (fixed)
wp_script_is() returns false for scripts enqueued via dependencies.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.9.1 |
Component: | Script Loader | Keywords: | has-patch |
Focuses: | Cc: |
Description
Register/enqueue a script with dependencies, e.g.
wp_enqueue_script( 'wc-cart', $src, array( 'jquery', 'wc-country-select' ), $version, true );
With the above example I've enqueued wc-cart and, via a dependency, wc-country-select. The problem is:
wp_script_is( 'wc-country-select', 'enqueued' );
will always return false. This is due to the query method in the WP_Dependencies class not checking the dependencies of each enqueued handle.
IMO this should return true. The script is enqueued via dependency - without a way to check this I cannot conditionally localize my scripts without checking all dependencies.
Fix will be attached.
Attachments (2)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Patch for #28404