Edit: new solution, based on one of the comments. If you are using wp_enqueue_script
to load your js file, make sure jQuery
is a dependency so that it gets called before your code:
wp_enqueue_script( 'my_script', 'my-script.js', array( 'jquery'), $ver, true );
You can then remove the original enqueue call you had since jQuery
will be included automagically
Related Posts:
- force enqueue script to be first in order of prominence
- How do I force wp_enqueue_scripts to load at the END of ?
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- How do I make sure a plugin loads a script after jQuery
- Calling JavaScript file with Custom Plugin
- Problem in loading javascript in footer
- jQuery for custom plugin not working with Divi theme
- Create shortcode to echo javascript
- Enqueue script: link not working in page source
- sliding/fading header plugin or approach suggestion
- How to install jquery dotdotdot plugin for WordPress?
- Adding Additional Attributes in Script Tag for 3rd party JS
- Pass PHP variable to javascript
- WordPress 3.5 Media Manager – add a button
- Help making my pagination plugin better
- Which method is best to enqueue scripts
- Is dynamic forms/entries possible in Widget?
- Get info (url) from already enqueued styles
- jQuery AJAX call not executing in Plugin
- Change My Basket text in the header of WooCommerce Artificer theme
- Pass $this to function nested in another public function of the same class
- Dequeue / Deregister script and replace it with a new plugin
- dequeue not work
- Adding Scripts in the Admin Area
- Overriding a function in wordpress
- How to load default scripts included with WordPress correctly?
- Get image URL from media library in input
- Ajax with jQuery UI dialog not working
- Register script in one plugin, and enqueue it in another
- How to remove style and js from theme and add your own style and js where shortcode is used?
- scrolltop always 0, can’t trigger script
- Bootstrap Drop Down menu is not working
- Best approach to fetch data from wp options to js file or php file
- WordPress repository forbids me call wp-load.php in non-WordPress file
- wordpress site | All-in-one-cufon IE Issue
- Headers Content-Security-Policy CSP Major Issue
- Modifying a .js Function for Print [QZ Tray, WooCommerce POS]
- How to hide CSS by default and show on button press
- jquery tinymce and bundled wp plugins
- Using window.onload with Ubermenu
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Jquery plugin not working on single pages
- How to include this jQuery File in wordpress?
- My single.php page does not show the related data to the post which is clicked
- Enqueue stylesheet in plugin for wp-login.php
- a weird attribute on every html tag
- How to add an element right after the article using jQuery?
- wordpress add_action() issue in ajax call
- JQuery prepend a function
- Register google jquery gets overwritten by plugin
- Custom Login Page — wp_signon Headers Already Sent?
- I changed .live() to .on() but change is not reflected on the server
- Save user total active time after login in wordpress [closed]
- Why does my jQuery plugin show up as text in WordPress?
- Disable submit button order
- How to include my Ajax calls in one function instead of calling different ones every time?
- jQuery code didn’t run on my plugin
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Cannot access WP admin because plugin returns 204
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- Using AJAX to run SQL statement and populate dropdown
- WordPress slider that allows image, headline, text, and button?
- Adding a jQuery modal dialog to the admin area
- How do I fill the Home Description?
- How to make a slider hearder?
- Edit all $wp_scripts at once to $in_footer = false
- Jquery POST Ajax Return null data in wordpress
- WordPress jQuery Post – Amending Variable Value Within Function Command
- wordpress plugin add page when activate
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- Overriding inline !important CSS with Javscript code snippet with media query
- Enqueue plugin for specific pages
- update_post_meta is not working for me when I use e.preventDefault for update button
- Why can I not deregister my style and script on custom post type?
- jQuery works instead of $
- checkout stripe with plugin contact form
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- Debug in WP backend
- How do I keep children of certain parent menus expanded by default on a sidebar?
- Help with customising love it plugin (use within foreach)
- Primary Menu doesn’t show because of w3 cache
- Javascript in plugin not working
- Creating a comments voting system
- How to add jquery to my custom post type wp plugin
- What is the process for reimplementing a back up WordPress?
- Like/Dislike Bar not working when updating
- jquery-issue: cannot load the basic jquery
- Possible jquery / library conflict in plugin usage
- Add jQuery in dashboard when is already added in main plugin page
- WordPress include scripts and style in plugin page
- Change text “My Basket” in woocommerce artificer theme
- Why won’t the Comprehensive Google Map Plugin load?
- get_option include in my adsense
- Javascript as Jquery Function Call?
- JQuery UI plugin not working in IE7?
- Jquery based image accordian plugin
- wordpress jquery is not defined because the head tag is empty
- wp_enqueue_script doesn’t load JS in plugin
- How to add an active state class to my info box