I'm fixing a wordpress plugin that uses a 1.0.0 version of jquery. The jquery version automatically included in wordpress is 1.11.0. In a test site, the plugin is dependent on the 1.0.0 jquery and doesn't work on the latest version.
However, it works on a test site because the plugin is loaded BEFORE the wp-includes/js/jquery/jquery.js and it uses it's own jquery library version before the script is overwritten by the latest jquery version. It doesn't produce any errors in the console.
But in the production site, it loads all the plugins after the wp-includes/js/jquery/jquery.js So, how do I force the plugin to load, before wordpress loads the wp-includes/js/jquery/jquery.js file?
This is the code in the plugin:
add_action('init', 'myplugin_init');
function myplugin_init() {
wp_enqueue_script('jquery.min', plugins_url(MYPLUGIN_FOLDER . '/js/jquery.min.js'), array(), '1.0.0', false);
wp_enqueue_script('highcharts', plugins_url(MYPLUGIN_FOLDER . '/js/highcharts.js'), array(), '1.0.0', false);
wp_enqueue_script('exporting', plugins_url(MYPLUGIN_FOLDER . '/js/exporting.js'), array(), '1.0.0', false);
}
I already tried, for testing purposes, to force the enqueue of plugin scripts right before wp_head();
but it still loads the plugin files AFTER the wp-includes/js/jquery/jquery.js.
<?php
wp_enqueue_script('jquery.min', plugins_url(MYPLUGIN_FOLDER . '/js/jquery.min.js'), array(), '1.0.0', false);
wp_enqueue_script('highcharts', plugins_url(MYPLUGIN_FOLDER . '/js/highcharts.js'), array(), '1.0.0', false);
wp_enqueue_script('exporting', plugins_url(MYPLUGIN_FOLDER . '/js/exporting.js'), array(), '1.0.0', false);
wp_head();
?>
Any help is much appreciated. Thanks.