WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Is it possible to upgrade jQuery in WP? (6 posts)

  1. spstieng
    Member
    Posted 5 years ago #

    I need to use the lates jQuery for my WP installation. Default version is 1.2.6.

    This is what I try and here are the results:

    Test 1 / adding jQuery through a plugin

    ### Function: add javascripts
    add_action('init', 'add_scripts');
    
    function add_scripts() {
    
        wp_enqueue_script('jQuery');
    }

    Test 2 / adding jQuery through a plugin

    ### Function: add javascripts
    add_action('init', 'add_scripts');
    
    function add_scripts() {
    
        wp_enqueue_script('jQuery', WP_PLUGIN_URL . '/wp-my/new/plugin/js/jQuery.js');
    }

    Looking at the source code, I see this:
    <script type='text/javascript' src='http://localhost/dev2/wp-content/plugins/wp-store-locator/js/jQuery.js?ver=2.7.1'></script>

    Version 2.7.1? Looking at jQuery.js, it says v1.3.6.....

    And what about replacing the old jQuery.js with the new version? IS that good or bad?

  2. spstieng
    Member
    Posted 5 years ago #

    Oh yeah...... that was just in the frontend.
    Looking at the backend (administration), it suddenly has added this line too:
    <script type='text/javascript' src='http://localhost/dev2/wp-includes/js/jquery/jquery.js?ver=1.2.6'></script>

    Now this will certainly crash. How the h*** can I avoid wp-admin adding this last line?

  3. spstieng
    Member
    Posted 5 years ago #

    Shit.... I posted this in the wrong catgory. Should offcours be in the Troubleshooting part.

    I found this thread. Its about using wp_deregister_script('jquery').

    I will test his now ans see what happends. My guess a lot of admin stuff will break :(

  4. spstieng
    Member
    Posted 5 years ago #

    Ah crap. This suxx.

    Using jQuery version 1.3.7 in wp-admin do indeen break the admin functionality.

    So much for craeating plugins :(

    Does anyone know if WP is upgrading jQuery anytime soon?

  5. spstieng
    Member
    Posted 5 years ago #

    Oh... btw.

    I still have a plugin to add the newest jQuery.
    It basically looks like this:

    if ( !is_admin() ) // using a newer version of jQuery will break stuff in WP admin
         {
          wp_deregister_script('jquery');
          wp_enqueue_script('jQuery', WP_PLUGIN_URL . '/wp-store-locator/js/jQuery.js');
    
         }
  6. travelvice
    Member
    Posted 4 years ago #

    Thank you spstieng -- this last snippet was exactly what I needed to force the use of my updated copy of jquery

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags