Opened 9 years ago
Last modified 6 years ago
#35963 new defect (bug)
Only remove item from WP_Dependencies::to_do if it was successfully processed
Reported by: | pcfreak30 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
If WP_Dependencies::do_item returns false, the item is removed from being processed again. Due to this, if an item gets switched to the footer, it is never actually outputted. A common scenario is depending on jquery which depends on jquery-core and jquery-migrate. jquery is processed right, but jquery-core and jquery-migrate are moved to the bottom but still removed from the list.
The following example demonstrates:
<?php add_action('wp_print_scripts', function () { if (!is_admin()) { $jquery = wp_scripts()->registered['jquery']; wp_dequeue_script('jquery'); wp_deregister_script('jquery'); wp_register_script('jquery', $jquery->src, $jquery->deps, $jquery->ver, true); } }, 0);
Attached is a very simple patch to resolve this
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Previously: #25247