Back to top

Affiliate Link: Interested In a Useful Tables For Amazon Products and More? Check Out:

Amalinks Pro

Enable JQuery With Code Snippets (No More Theme Edits)

As an Amazon Associate we earn from qualifying purchases made on our website. If you make a purchase through links from this website, we may get a small share of the sale from Amazon and other similar affiliate programs. You can read our complete legal information for more details.

I have spent a decent chunk of time trying to find a more reliable way to ensure the JQuery stays enabled without loading bulky plugins or without editing the theme itself. This is due to plugins causing load issues just to have JQuery for your needs or theme edits which are overwritten when the theme updates occur.

This requires loading a 0 impact plugin which allows you to add code edits and inject them into your WordPress installation. This is my favorite all-time plugin [ Code Snippets ].

Then after you install Code Snippets you will just need to activate it, click on [ Import ] and import the file below. Once imported just click [ Save and Activate ]

Download Code Snippet JSON File

(Right Click and Save As)

If you still experience issues it could be due to the version I loaded in JQuery, if this happens then replace all the code in the snippet with the code below and save and try again.

add_action( 'wp_enqueue_scripts', 'wp_jquery_manager_plugin_front_end_scripts', 999 );

function wp_jquery_manager_plugin_front_end_scripts() {
        wp_register_script( 'jquery', false, array( 'jquery-core' ), null, false );
        wp_enqueue_script( 'jquery' );
    }

If you find a post helpful and feel like rewarding my effort with the price of a beer, please donate here

About Josh Koop

Hey Everyone! I hope that the short article you read today has taken you from a place of frustration to a place of excited anticipation for your visitors! Please let me know of anything you need for Acabado that can help you achieve your goals! Read More About Me...

My Posts | Website

Josh Koop

Hey Everyone! I hope that the short article you read today has taken you from a place of frustration to a place of excited anticipation for your visitors! Please let me know of anything you need for Acabado that can help you achieve your goals! Read More About Me...

12 thoughts on “Enable JQuery With Code Snippets (No More Theme Edits)

  1. Thanks! I needed this as I had just updated my theme and my previous alteration to the theme disappeared. I am using this way now and its working perfectly! Thanks Josh!

  2. Hey, I followed all your steps and enabled jquery for acabado However am facing an error http://prntscr.com/q6ibv7 while i am trying to run the plugin its not working properly.How can i fix it?

    1. Did you use the snippet? As I have it on multiple sites using that method with no problems. If you do then you need to look at what cache or optimization plugin you installed that defers loading jquery and java until later.

  3. Hey, I did these steps in order to have mailchimp working in order for me to collect emails from my vistiros. Its still not finding the code in the Header.PHP according to the mailchimp dashboard. What could I be doing wrong?

    I just wanted a simple popup an automation when receiveing a new email.

      1. Thank you for your quick response. I’m trying to add a strip of code that Mailchimp provides just before the end tag. Please check the link for the exact instructions I’m following

        https://mailchimp.com/help/about-connected-sites/?_ga=2.92765332.883254786.1579966424-376959135.1579966424

        It seems that I keep getting an “Uh oh, we couldn’t connect your site. Check your code and try again.” message every time I attempt to add it.

        1. It says to place in the header,

          In your website’s HTML, paste the code just before the closing < / head > tag.

          So are you using a plugin like HFCM to insert this into a header location? After the code is in your header that you need to flush all the cache on your site, WordPress, Server, etc. This will then regenerate the head again which should then contain the code.

          1. I downloaded HFCM and used it for the Mailchimp code. I cleared the catch using the free version of WP Fastest Cache. But it’s still not finding the code. But something weird happened. The pop-up is active and collecting emails even though it says

            “Uh oh, we couldn’t connect your site. Check your code and try again.”

            I guess its working. somehow.

          2. Well, I have installed them before without issue. Without knowing the site and the full setup it is hard to troubleshoot as it could be many things from plugins, to server cache to php version. If you are still seeing issues reach out to your host and see if they can help pinpoint your actual issue as it will give you a path forward.

  4. I use Wordfence’s 2 factor authentication for logging in to my site, and it’s failing at the moment because JQuery wasn’t enabled in Acabado.

    I added the code snippet, but am getting an “Uncaught ReferenceError: jQuery is not defined” at the login stage. How can I stop the jQuery plugin (Wordfence) being included before jQuery file itself? Thanks!

    1. You need to ask WordFence, since it isnt in the theme I can only load it after. I would suggest asking if that can be delayed or removed as a requirement in the first place.

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Content