Support » Plugin: Ad Inserter - Ad Manager & AdSense Ads » Ad Inserter Moves jQuery Back to Top

  • Resolved ispreview

    (@ispreview)


    Quick question, before installing Ad Inserter I used a simple functions.php code to shift WordPress’s jquery scripts to the bottom of my page for more efficient loading. The code I used for this is as follows:

    /* Move jQuery to Footer */
    add_action( 'wp_enqueue_scripts', 'move_jquery_into_footer2', 0 );
    function move_jquery_into_footer2() {
        if( is_admin() ) {
            return;
        }
        $wp_scripts = wp_scripts();
        $wp_scripts->add_data( 'jquery',         'group', 1 );
        $wp_scripts->add_data( 'jquery-core',    'group', 1 );
        $wp_scripts->add_data( 'jquery-migrate', 'group', 1 );
    }

    However as soon as Ad Inserter is enabled this code no longer seems to do anything and the jquery js files are pushed back to the top of the site, which can impact loading times as I rarely use this code. Does anybody know why this occurs and if it’s possible to push them back to the bottom?

Viewing 1 replies (of 1 total)
  • Plugin Author Spacetime

    (@spacetime)

    Hello,

    Ad Inserter makes sure jQuery is loaded before it is used.
    Some functions like client-side insertions may need the library before the page loads.
    Therefore, Ad Inserter signals WP to load jQuery (in the head) whenever you are using any feature that uses jQuery.

    I will consider an option to configure loading of jQuery.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.