WordPress.org

Ready to get started?Download WordPress

Forums

AssetsMinify
Built-in scripts that should be enqueued in footer are enqueued in header (1 post)

  1. szaqal21
    Member
    Posted 3 months ago #

    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) ).

    http://wordpress.org/plugins/assetsminify/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.