0

I have been trying to deregister the wordpress native jquery and use my version that i have downloaded.At first everything was working fine with the wordpress resident jquery albeit replacing $ with jQuery in my custom.js script.

I am using media-uploader in my theme and i added the scripts using this code;

function wptuts_options_enqueue_scripts() {
    wp_register_script( 'wptuts-upload', get_template_directory_uri() .'/admin/js/mlimage.js', array('jquery','media-upload','thickbox') ); 

        wp_enqueue_script('jquery');

        wp_enqueue_script('thickbox');
        wp_enqueue_style('thickbox');

        wp_enqueue_script('media-upload');
        wp_enqueue_script('wptuts-upload');

}
add_action('admin_enqueue_scripts', 'wptuts_options_enqueue_scripts');

I have this code to add my custom jquery

function en_jquery()  
    {  
        wp_deregister_script( 'jquery' );   
        wp_register_script( 'daskustomjquery', get_template_directory_uri() . '/admin/js/jquery-1.7.2.min.js' );    
        wp_enqueue_script( 'daskustomjquery' );         
    }  
    add_action( 'admin_enqueue_scripts', 'en_jquery' );

Whenever i try excluding jquery from this line's array,wp_register_script( 'wptuts-upload', get_template_directory_uri() .'/admin/js/mlimage.js', array('jquery','media-upload','thickbox') );

none of the scripts get loaded.Is it possible to exclude the wordpress jquery and use the jquery-1.7.2.min i have downloaded?.

1 Answer 1

3

Your specific issue is that you are registering custom jQuery version to different handle ('daskustomjquery') and naturally that breaks things.

But please note that interfering with jQuery in admin is extremely not recommended.

3
  • Thanks for the tip.I am trying to submit a form + the submit button value using the jquery malsup form plugin.It works with jquery-1.7.2.min(a simple html file with jquery and the plugin) but fails to submit the submit button value with the wordpress jquery.
    – Gandalf
    Aug 19, 2012 at 21:26
  • @flapjack jQuery 1.7.2 is the version WP currently includes, whatever your issue it's probably not because of the version.
    – Rarst
    Aug 19, 2012 at 21:31
  • Oh wow,i didn't know that.I shall look at my code harder and see what is amiss.Thanks.
    – Gandalf
    Aug 19, 2012 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.