jQuery included twice breaks other plugins/code
-
wp_register_script(Helper::tokenize('jquery-public'), "https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js", false, null); wp_enqueue_script(Helper::tokenize('jquery-public'));
By using the name ‘jquery-public’ instead of ‘jquery’ you are causing jQuery to be loaded twice.
We are already en-queuing the standard (included with WordPress) jQuery library (and jquery-migrate); so your plugin should not need to load another version of jQuery.
It would be better if you didn’t wp_enqueue_script jQuery at all, and modified your scripts that require jQuery to depend on ‘jquery’ (rather than ‘jquery-public’).
Wordpress will then only load jQuery if it hasn’t already been loaded.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘jQuery included twice breaks other plugins/code’ is closed to new replies.