Make WordPress Core

Changeset 31028


Ignore:
Timestamp:
01/03/2015 02:40:11 AM (12 years ago)
Author:
wonderboymusic
Message:

When calling wp_enqueue_script() with a registered $handle, no $src (using the default value, false), and true as the value for $in_footer, ensure that the script actually loads in the footer. If the handle was registered with $in_footer equal to true, this already worked. Make it work for scripts like where $in_footer was initially false, example: wp_enqueue_script( 'json2', false, array(), false, true );

Props SergeyBiryukov.
Fixes #14488.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.wp-scripts.php

    r30674 r31028  
    204204        }
    205205
     206        $_handle = explode( '?', $handle );
     207
    206208        if ( $src ) {
    207                 $_handle = explode('?', $handle);
    208209                $wp_scripts->add( $_handle[0], $src, $deps, $ver );
    209                 if ( $in_footer )
    210                         $wp_scripts->add_data( $_handle[0], 'group', 1 );
    211         }
     210        }
     211
     212        if ( $in_footer ) {
     213                $wp_scripts->add_data( $_handle[0], 'group', 1 );
     214        }
     215
    212216        $wp_scripts->enqueue( $handle );
    213217}
Note: See TracChangeset for help on using the changeset viewer.