johnbillion / query-monitor

The developer tools panel for WordPress
https://querymonitor.com
GNU General Public License v2.0
1.59k stars 208 forks source link

Admin footer scripts missing from the Scripts panel since WordPress 6.0 #729

Closed johnbillion closed 1 year ago

johnbillion commented 1 year ago

The "Scripts" panel is not showing all enqueued scripts; it's missing scripts enqueued in the footer of the admin area. This can be seen by, for example, looking at the "Dependents" column and noting that not all dependents are listed.

This seems to have started happening in WordPress 6.0 with this change: https://github.com/WordPress/wordpress-develop/commit/37c08a07f05f75f888842c84224895d978b159e8.

Ideally need acceptance tests for this since this is a pretty big error to go unnoticed.

johnbillion commented 1 year ago

Git bisect tells me this is the problematic commit: https://github.com/WordPress/wordpress-develop/commit/37c08a07f05f75f888842c84224895d978b159e8

johnbillion commented 1 year ago

This is a priority issue. Both QM and WordPress core use priority 10 for their admin_print_footer_scripts callbacks, and QM needs to fire after core. The change in 6.0 caused core's _wp_footer_scripts() callback to fire after QM's assets collectors, which broke the detection of scripts enqueued in the admin footer.

Specifying a higher priority for QM fixes this.