Go to Top

jQuery is not defined in WordPress 3.4

When I installed WordPress 3.4, my plugins that uses jquery suddenly didn’t work.

Here’s how I fixed it. Add these codes on your plugin.
{code}
add_action(‘wp_head’, ‘load_scripts’); // to load jquery on the font page
add_action(‘admin_head’, ‘load_scripts’); // to load jquery on the admin page

function load_scripts(){
wp_enqueue_script(‘jquery’);
//other scripts
}

{/code}

4 Responses to "jQuery is not defined in WordPress 3.4"

    • webdevtuts
      June 23, 2012 - 4:30 am

      some plugins that uses jquery. It depends on the plugin called the jquery. If it simply calls it using wp_enqueue_script, then it would result to an error. It should be called inside a function (explained above)

  • valuser
    June 17, 2012 - 11:10 am

    Some plugins have many files.

    Which file is the most appropriate for this addition ?

    • webdevtuts
      June 23, 2012 - 4:33 am

      it can be placed on any php files.

Leave a Reply