Opened 9 years ago
Closed 5 months ago
#40134 closed defect (bug) (worksforme)
Invalid data for scripts in footer
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Script Loader | Keywords: | |
| Focuses: | Cc: |
Description
During register scripts via wp_register_script in last param I can choose that script should be in footer. In function we see:
<?php if ( $in_footer ) { $wp_scripts->add_data( $handle, 'group', 1 ); }
so footer scripts I should check use this code:
<?php $wp_scripts = wp_scripts(); if ( $wp_scripts->get_data( $handle, 'group' ) ) { echo 'in footer'; } else { echo 'in header'; }
I check for this: admin-bar and I have false -> in header. We can see this code:
<?php $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
This should be in footer (and is, but I can't check it via my script).
I think that this is bug.
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
I don't understand the issue being described. It seems like the issue is about the basic functionality of
::add_data()and::get_data(). I don't see any problems with their behavior.I adapted the example and tested:
int(1)is printed as expected.