• Resolved szaqal21

    (@szaqal21)


    Built-in scripts (added in wp-includes/scripts-loader.php) for example this:
    $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.10.3', 1 );
    should be printed in footer (last argument: 1) and this works fine when I don’t use AssetsMinify. But when I activate AM I can see them being printed in header. I’ve made some search and found the potential problem. In AssetsMinifyInit.php near line 187 there is a check:
    if ( empty($wp_scripts->registered[$handle]->extra) )
    and this is ok for scripts being enqueued by user but not built-in scripts I think. I’ve printed out $wp_scripts before that line and I can see that built-in scripts have ‘extra’ attribute set to empty instead they have ‘args’ attribute set to ‘1’. So my conclusion is to modify the above conditional to this:
    if ( empty($wp_scripts->registered[$handle]->args) && empty($wp_scripts->registered[$handle]->extra) ).

    https://www.ads-software.com/plugins/assetsminify/

  • The topic ‘Built-in scripts that should be enqueued in footer are enqueued in header’ is closed to new replies.