Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:01:06+00:00 2026-05-23T13:01:06+00:00

it’s been suggested to me to use wp_unregister and wp_enqueue to replace wordpress jquery

  • 0

it’s been suggested to me to use wp_unregister and wp_enqueue to replace wordpress jquery library with a google hosted one (because the wordpress one was having some problems)

However, when i try to insert these into my wordpress site, it breaks my site.

Do I need to wrap them somehow?

wp_unregister_script('jquery');
wp_unregister_script('jquery-ui-core');

wp_enqueue_script('jquery', https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js);
wp_enqueue_script('jquery-ui-core', https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js);

My site has a custom folder where I can put custom functions. I tried this unsuccessfully

function googlejqueryhost(){


<?php
wp_unregister_script('jquery');
wp_unregister_script('jquery-ui-core');

wp_enqueue_script('jquery', https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js);
wp_enqueue_script('jquery-ui-core', https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js);


?>
}
add_action('wp_head', 'googlejqueryhost');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:01:06+00:00Added an answer on May 23, 2026 at 1:01 pm

    Based on the code I’ve demonstrated in this blog post, how about this:

    function load_jquery() {
    
        // only use this method is we're not in wp-admin
        if (!is_admin()) {
    
            // deregister the original version of jQuery
            wp_deregister_script('jquery');
    
            // discover the correct protocol to use
            $protocol='http:';
            if($_SERVER['HTTPS']=='on') {
                $protocol='https:';
            }
    
            // register the Google CDN version
            wp_register_script('jquery', $protocol.'//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', false, '1.5.2');
    
            // add it back into the queue
            wp_enqueue_script('jquery');
    
        }
    
    }
    
    add_action('template_redirect', 'load_jquery'
    

    I use the template redirect hook, I wonder if that is what is causing your issues.

    Either way if this doesn’t work can you give more info on the issue, have you got a link to the site?

    Edit

    Oh, also your function opens up PHP tags when really they should already be open, see my comments…

    function googlejqueryhost(){
    
    
    <?php // HERE, remove this
    wp_unregister_script('jquery');
    wp_unregister_script('jquery-ui-core');
    
    wp_enqueue_script('jquery', https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js);
    wp_enqueue_script('jquery-ui-core', https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js);
    
    
    ?> // AND HERE, remove this
    }
    

    Edit 2

    You’ll notice your site is now correctly loading jQuery from Google’s CDN, the other script has nothing to do with the jQuery library itself.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm making a simple page using Google Maps API 3. My first. One marker
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.