The proper way to include jquery in your plugin is
/**
* Proper way to enqueue scripts and styles
*/
function theme_name_scripts() {
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
Related Posts:
- ajaxurl not defined on front end
- Why does WordPress use outdated jQuery v1.12.4?
- How to add a javascript snippet to the footer that requires jQuery
- How to include jQuery and JavaScript files correctly?
- How Do I Use jQuery UI In My Plugin
- Remove profile picture option (and other things) from profile.php (in admin)
- Test to see if jQuery or Prototype is queued by another plugin?
- jQuery in header or footer
- Hook the Keydown Event in the TinyMCE Post Editor
- Add a jQuery function to admin pages
- How to Add a .js file Only in one specific Page Dynamically to Head
- Help adding image upload functionality to widget
- How to trap “Publish” button to check for meta box validation?
- Use js script from one plugin in another plugin
- Using Ajax call in jQuery doesn’t work in widget
- wp_enqueue_style built in styles
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Admin-ajax.php appending a status code to ajax response
- Plugin admin page meta_box toggle and order state not saving
- WordPress plugin options and jQuery
- Ajax in WordPress – path issue
- Mixing Regular Javascript With jQuery in a Plugin
- Loading jQuery and jQuery plugin script files correctly [duplicate]
- jquery document ready function not being called [closed]
- Add a row on clicking each post featured image
- how to add Jquery script to one page?
- Is there an event or an other method that tells me the preview is loaded?
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- how to search users by ajax live search
- jQuery selectors for editor elements safe to use?
- Display WordPress the_content() via data attributes
- javascript datatables in a plugin
- WordPress custom taxonomy check box to dropdown
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- jQuery in WordPress Plugin
- WP Plugin Running before jQuery
- jquery & ajax sending data to php
- should i be checking for jquery before enqueing it in a plugin
- jQuery instantly executes (a button click and css change) on load
- How to include jQuery into my plugin so I can use it on plugin page?
- Ajax submit result opens in admin-ajax.php
- how to get the post id in plugin
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to enqueue scripts in right way in a plugin?
- making a plugin that moves other plugins wp_head actions to wp_footer
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- WP ajax requests not stacking?
- Need help about understand api, wp, $ syntax in WordPress plugin script
- Insert Into Post Not Working For Audio File Using jQuery
- How to disable a jQuery plugin on WordPress plugin page
- jquery in wordpress plugin with depdendency
- ajax working when function is on child theme but not in plugin page
- Using function from enqueued .js file in theme in plugin?
- jQuery UI tab does not work in the plugin page
- How to overwrite iris color pallates from theme to plugin
- Ajax +wordpress onClick link redirect to new page and create html content
- Use options to control jQuery plugin
- Thickbox in Plugin settings page?
- How to localize data array in plugin’s option page
- sanitizing/escaping plugin options
- Load php file with jquery in single.php
- Loading Images from Javascript on the Front End
- Using jQuery prepend() with file include
- How to deal with different jQuery versions?
- Get cat parameter from admin-ajax
- Ajax on the Administration Side of plugin – returns 0
- wp.media gallery collection sometimes undefined
- escape html in jQuery for WordPress
- Jquery php request is returning a weird result
- Query String Filtering API
- jQueryUI draggable doesn’t work in WordPress plugin
- $ is not defined [duplicate]
- setTimeout not working in jquery
- WordPress Jquery with heade and footer sritp plugin
- WordPress Ajax not returning Response
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- replacing jquery google cdn with a new version dynamically
- WordPress function is not called and ajax return 0
- Ajax call not working with
- How can I add the Post ID to Class Name in Jquery?
- Template file structure , wordpress hook for altering the template
- Script work on non logged in user but not work for logged in user?
- How do I call the dashboard’s sortable javascript in a plugin page?
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- Page reload occurs before request finishes
- Loading jQuery library from WordPress admin
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- How to get the value entered in the input field in wordpres
- How react js and other Javascript Technologies works on WordPress plugin?
- How to access Elementor-navigation-elements via jQuery
- Insert meta-description into Yoast-SEO input-field via JavaScript
- Create custom HTML/JS app inside page
- Upload multiple images and insert them into custom html code
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated