0

So apparently I am now allowed to do the following in the admin, ON my theme options page and only ON my theme options pages:

public function load_admin_jquery(){
    if(isset($this->_options['admin_jquery_version'])){
        wp_deregister_script ( 'jquery' );
        wp_register_script ( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/'.$this->_options['admin_jquery_version'].'/jquery.min.js' );
        wp_enqueue_script ( 'jquery', true, true );             
    }
}

Can some one explain why? I am only setting the new version of jquery ON my theme options pages ONLY

The exact error is:

Notice: wp_deregister_script was called incorrectly. Do not deregister the jquery script in the administration area. To target the frontend theme, use the wp_enqueue_scripts hook. Please see Debugging in WordPress for more information. (This message was added in version 3.6.) in /var/www/wordpress/wp-includes/functions.php on line 2986

I have Twitter bootstrap loading in my theme options page and I would like to be in control of the jquery version being used.

1 Answer 1

0

All other scripts running on that page depend on the correct jQuery file shipped with WordPress: admin bar, jQuery-UI or other plugins.

Note that loading external resources is not possible in all setups, so your options page would not work in these cases.

To use scripts that needs $ use $ = jQuery.noConflict(); or put it into a wrapper.

1
  • >.> this is redic.
    – TheWebs
    Commented Apr 6, 2013 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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