• Resolved c.note

    (@cnote)


    Happy with this plugin but I load the latest jquery lib as part of my theme so I don’t need the another jquery file enqueued by this plugin.

    How do I stop it being loaded?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter c.note

    (@cnote)

    No idea how or where the plugin is triggering the load but wp_deregister_script serves the purpose.
    wp_deregister_script( ‘jquery’ );

    Although the plugin doesn’t seem to work without the old version of jquery.

    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey c.note,

    Our plugin works with most newer versions of jQuery though it’s guaranteed to work with the version that comes bundled with WordPress.

    Some versions exclude the code to allow AJAX calls. Is this possible? If you send a link to a page with the feed on it I can tell you what the issue is for sure.

    – Craig

    Thread Starter c.note

    (@cnote)

    Hi,

    Its a custom theme so pretty much all script enqueueing is customised and I’m using https://code.jquery.com/jquery-3.2.1.min.js in header.php as far I ‘m aware that not one of the light versions. Incidentially I see its actually one sub version removed from the latest as its now 3.3.

    When I wp_deregister_script(‘jquery’) the Instagram widget hangs on the loading icon. No errors in the console.

    Screenshot on tinypic

    Its not a big problem the only impact I have noticed is I have to place a couple of jquery plugin link tags in the footer (jquery.backstretch.min.js,bootstrap.min.js etc.) instead header otherwise I get a js error because of the old jquery file.

    I try to follow best practice as much as I can and to me it doesn’t make sense to load jquery twice if I can avoid it.

    Cheers

    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey again,

    The screenshot you sent suggest some kind of JavaScript error. I can see what’s going on if you send a link to the page. Let me know if you’d like me to look into it more.

    Thanks,

    Craig

    Thread Starter c.note

    (@cnote)

    Hi,

    Thanks for the offer, I’m keen to discover the solution so I will try to get it online ASAP and send a link.

    In the meantime I’ve managed to look at it again on my local environment and I noticed that when I add the deregister the CDATA and instagram js file aren’t added to the footer. I’ve added it manually everything appears to work.

    I used the same approach I’ve implemented for other plugins where I prevent an older version of jquery being loaded, this for example is the approach recommended for Contact 7 Form applied to Instagram Feed.

    Does that make sense?

    <?php if(function_exists('sb_instagram_scripts_enqueue')): ?>
    <script type="text/javascript">
    /* <![CDATA[ */
    var sb_instagram_js_options = {"sb_instagram_at":"197202987.M2E4MWE5Zg==.NjA1MmJjOWRmMzUzN.DU0MjgzN2JkYWFkODNlZjFhM2E=","font_method":"svg"};
    /* ]]> */
    </script>
    <?php
        $url = plugins_url('instagram-feed/js/sb-instagram.min.js?ver=1.8.3');
        echo "<script type='text/javascript' src='$url'></script>";
    endif;
    ?>
    • This reply was modified 7 years, 10 months ago by c.note.
    Plugin Contributor Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Yeah that makes sense. This code is added using wp_localize_script which will not add this code to the page if the script is deregistered. This should work fine for you if it fixes the problem.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Prevent the plugin loading jquery.js’ is closed to new replies.