WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this part of code which loads custom version of jquery

        wp_register_script('jquery', ("http://code.jquery.com/jquery-latest.min.js"), false, '');

Everything works fine but if i open the media upload manager which is loaded by this code


and triggered by this

                <script language="JavaScript">
                    jQuery(document).ready(function() {
                    jQuery('#upload_image_button').click(function() {
                    formfield = jQuery('#upload_image').attr('name');
                    tb_show('', 'media-upload.php?type=image&TB_iframe=true');
                    return false;

                    window.send_to_editor = function(html) {
                    imgurl = jQuery('img',html).attr('src');

                    <label for="upload_image">
                        <input id="upload_image" type="text" size="36" name="upload_image" value="<?php  ?>" />
                        <input id="upload_image_button" type="button" value="Upload Image" />
                        <br />Enter an URL or upload an image for the banner.

The lightbox opens and displays all options, but when i choose "Upload Image" or if i go to media library and select an image from there nothing happens.

If i remove the custom jquery the media uploader works fine. But then the jquery ui code i have is not working, although i am loading the jquery-ui script, so i have to load my custom latest version of jquery.

Is there any solution so both media-upload and jquery-ui are working on the same page in the plugins admin panel?

share|improve this question
Fix the custom jQuery code? – toscho Jul 19 '12 at 12:48
What do you mean?By custom version i mean(as shown in the code) that i am loading the latest version of jQuery. I do not have any jQuery errors in my code. – Vassilis Barzokas Jul 19 '12 at 12:55
I mean the jQuery UI code you have written and that relies on the remote jQuery. Rewrite it until you can use the regular jQuery from WordPress. – toscho Jul 19 '12 at 12:58

A lot of people think it's a bad practice to deregister/reregister jQuery, despite the performance improvements c/o a CDNed version (and if you're going for a CDN, I see Google's version more often than jQuery's). However, if you're going to do that, you really should only do that on the front-end only so at least the admin can correctly assume that the current WP-preloaded jQuery version is being used.

So switch your script to this and I suspect your problems probably will end:

function my_custom_scripts() {
    if( !is_admin() ) {
        wp_register_script('jquery', ("http://code.jquery.com/jquery-latest.min.js"), false, '');
add_action( 'wp_enqueue_scripts', 'my_custom_scripts' );
share|improve this answer
Hey thanks, already tried that and as i say to my question when i remove the custom jquery version from admin the media-upload works fine, but then the jquery ui and other jquery scripts i am loading break down. Those scripts are loaded in the header and it looks like jquery version of wordpress is loaded after them. – Vassilis Barzokas Jul 20 '12 at 8:48
If it's an issue of loading order, you just need to specify the 'jquery' handle for the $deps argument of wp_enqueue_script() in your jquery-ui and custom scripts. – mrwweb Jul 20 '12 at 22:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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