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 recently added the following into my theme's functions.php, in order to load jQuery from the CDN:

function my_init_method() {
    wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');

add_action('init', 'my_init_method');

However, this causes problems with the admin screens, notably the WYSIWYG editor which then refuses to allow HTML mode (via the tab). I get an error:

jQuery is not defined

from the wp-admin/load_scripts.php file. What am I doing wrong?

share|improve this question
up vote 5 down vote accepted
jQuery is not defined

This is because the Google CDN Jquery is not in no-conflict mode. Use the following to make sure the included WordPress no-conflict jquery is used in admin.

if( !is_admin()){
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false, '1.4.2'); 
share|improve this answer
Brilliant - thanks Chris. – Bobby Jack Aug 24 '10 at 9:32
Any reason for putting strings into brackets? – hakre Aug 24 '10 at 9:39
missed one argument => false, '1.4.2', false, just say that cause for some theme jquery is in the footer – JMau Jan 15 '14 at 15:31

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.