You can ensure that jQuery is loaded by adding it to the $dependencies
array when you enqueue your script.
add_action( 'wp_enqueue_scripts', 'wpse384152_enqueue_my_scripts' );
function wpse384152_enqueue_my_scripts() {
wp_enqueue_script( 'my-script', '/path/to/my/script.js', array( 'jquery' ) );
}
That will ensure that a) jQuery gets loaded and b) it gets loaded before your script.
References
Related Posts:
- jQuery equivalent of JavaScript’s addEventListener method
- What is content-type and datatype in an AJAX request?
- Checking a Url in Jquery/Javascript
- When and why to ‘return false’ in JavaScript?
- How can I display a tooltip message on hover using jQuery?
- How is JavaScript .on() method defined?
- JQuery: $.get is not a function
- Bootstrap carousel not sliding
- Jquery to change form action
- How can I expand and collapse a using javascript?
- Detecting value change of input[type=text] in jQuery
- jQuery: using a variable as a selector [duplicate]
- jQuery – checkbox enable/disable
- How can I correctly format currency using jquery?
- How do I send this form's output to a new WordPress page?
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- Update jquery version
- Correct Method to run scripts with dependencies without enqueue?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- Using the WordPress Media Library and returning the Attachment ID rather than URL?
- WP set auth cookie using Ajax is not saved to browser
- Modify Custom Field in Media Library using JavaScript
- Loading jQuery With Two Fallbacks
- Localize variable for multiple Shortcodes
- ajax call in wordpress front end
- Including jQuery in WordPress
- Comment form vaildation
- Enqueuing jQuery in plug-ins
- Script doesn’t load because of a javascript MIME type error
- TinyMCE – TypeError: r is undefined
- Auto-detect javascript errors and warn theme user
- combining js scripts from a js newb [closed]
- Heartbeat API: How to access data already enqueued?
- Combining media queries with image sizes
- Implementing lazy loading in homepage posts instead of pagination
- Jquery integration with my theme
- How to stop focus() in custom js from scrolling to footer?
- Is it possible to hide media details sidebar when wp.media popup is being opened?
- Getting post meta in the flex slider
- Format numeric symbols in titles
- Removing jQuery from footer
- How can I make this custom menu work?
- Remove WordPress scripts
- Use jQuery to conditionally hide elements in Quick Edit
- Using bootstrap-slider and bootstrap-switch in wordpress admin panel
- WordPress jquery files not being enqueued
- what’s the best way to add a class to the div with a class of post every 4 seconds using jquery? [closed]
- Why Won’t my jQuery Play Nice with WordPress?
- Delete some text and change html tag with Jquery
- Unexpected script loading order
- Problem passing id-specific objects to javascript via wp_localize_script
- Creating a new div onclick wordpress+ajax
- Uncaught ReferenceError: jQuery is not defined . How do I define it correctly?
- Showing All the Posts in the Loop
- How to enque js script in footer that are not in .js file?
- Properly embed javascript into WP (using function.php) – doesn’t work?
- jQuery tabs plugin with callback to fetch data
- datepicker for custom post type admin
- Convert UL to dropdown list not working
- How to add plugin with jQuery to custom theme?
- JQuery Counter Limit not working for WP Comment Textarea
- Manipulate retrieved ajax data in php
- Disable auto hide of the login form on Woocommerce’s checkout page
- How To Include JavaScript Files Only In Single Posts?
- WordPress Front-End Theme Editor
- Sorting dynamic table content with jQuery
- Determine image height within Fancybox
- How to use JQuery Marquee in WordPress?
- WordPress 3.2.1: jQuery is not defined, breaks Admin panel
- inner anchor scrolling with wordpress
- Bootstrap and jQuery error: $ is not defined
- Fire action after enqueue script
- Auto next upon clicking image without clicking Next button
- Doing Math with Gravity Forms List
- I am trying to load a Js Dynamic Audio Synth [closed]
- Uncaught ReferenceError: jQuery is not defined
- Remove button from page if viewed through Customizer
- Target a specific page/template in jQuery
- Multiple level category drop-down three levels is not working
- Add a jQuery snippet for sepcific user role
- JQuery and Javascript to pan image
- How to add JS snippet before closing tag?
- Show/Hide text after the first paragraph
- How to specify url for ajax call in wordpress plugin
- Dynamic image grid gallery
- Check with jQuery value of checkbox from custom admin panel
- JS script not being included [closed]
- Hide input field when second input field is in focus
- WooCommerce – PrettyPhoto appending URL with #prettyPhoto
- Are you sure popup on Contact Form 7 [closed]
- Is it possible to append an external html file to my wordpress navigation?
- jscrollpane problem with my child theme
- Using jQuery toggle() in WordPress post to show/hide Tweet button?
- Change image on post title hover (more than one instance) – Jquery
- How to fire jQuery after $(window).on(‘load’)
- JQuery WordPress gallery [closed]
- My website si Blocked by google and warns the visitors that is Unsafe site
- how to make this work with jquery 1.12.4 [closed]
- Theme variation conflict with jquery select2 dropdown
- Enqueued jQuery not working