You should be using wp_register_script()
and wp_enqueue_script()
, so, for example:
add_action( 'wp_enquque_scripts', 'my_script_enqueue' );
function my_script_enqueue() {
wp_enqueue_script( 'my-jquery', 'URL TO THE FILE', array( 'jquery' ) );
}
Also, as mentioned by Zack, you should be registering your jQuery as such, as wordpress does not use $
for jQuery by default.
jQuery( document ).ready( function( $ ) {
//your jquery
});
Related Posts:
- How can I make my custom shortcode work in a Custom HTML Widget?
- Editor not displaying dynamically after clicking on the button
- Add jQuery to WordPress page
- jQuery function didn’t work in my plugin
- how to include a simple jquery file into a wordpress plugin
- Pass a php string to a javascript variable
- How to trigger $_GET request within admin plugin page?
- How can I get WordPress to save comments in markdown format?
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- Notepad sticky plugin
- Adding a slider captcha to the comment system
- How to put JQuery/Ajax inside shortcode?
- Error with Image Slide plug-in/ s3slider in WP
- wordpress site | All-in-one-cufon IE Issue
- WordPress function not being called from jQuery method
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- How to insert HTML/JavaScript form into WordPress page? [closed]
- How to prevent plugins from loading jQuery
- Using color picker in plugin, does input attribute order matter?
- Using window.onload with Ubermenu
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- wordpress add_action() issue in ajax call
- Adding media upload button to User Profile page (following a tutorial)
- How can I exclude a dynamic URL to show a popup created using ‘WordPress Popup’ plugin
- JQuery prepend a function
- Is there a function to list all uploaded images? How can I add one?
- Any idea how to get something like this to work? [closed]
- Is there a way to convert shortcodes to html content?
- the_content() printing DOCTYPE, and tags in the middle of page
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Save user total active time after login in wordpress [closed]
- Api external with wordpress
- File Uploader – Upload without adding to Media Library
- Wierd site output [closed]
- Custom meta box with jQuery.sortable custom post type list
- Code for unique user visit count on every page WordPress
- How do I reinit WordPress plugins dynamically using jS?
- WordPress jQuery Post – Amending Variable Value Within Function Command
- Overriding inline !important CSS with Javscript code snippet with media query
- WP Ajax DB issues
- How to get a specific string from a url
- How to translate to spanish wordpress hardcoded content/files?
- How to change a wordress plugin php code in my child’s functions.php file?
- update_post_meta is not working for me when I use e.preventDefault for update button
- make p tag collapsed after 3 rows
- Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
- How To Toggle User_Meta in frontend in a form using PHP
- Scroll to ID broken in main menu
- Get and Update Most Meta Value as an array in HTML form
- Can’t access 3rd party API, code works on local server but not on wordpress
- How to echo a PHP Code After the Content
- Help with customising love it plugin (use within foreach)
- How to remove a css class for any wordpress page
- Form tries to download a file on submit
- Add HTML between feed items
- Adding link on title its in description but not in title see screenshots attached
- AJAX doesn’t pass variables to the php function in the plugin
- What is the process for reimplementing a back up WordPress?
- Possible jquery / library conflict in plugin usage
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- PHP and Jquery pass value from form. Update function on DataBase
- Plugin use of ajax/jquery depending dropdown
- How do I output user_registered time in my correct timezone?
- Element works, but not on wordpress site [duplicate]
- wordpress illegal string offset ‘parameter’ error
- wordpress jquery is not defined because the head tag is empty
- Need help with wordpress audio preload
- Option value not getting updated until page refresh in WordPress
- Limit entry to a WordPress page
- How to create a “Most Popular” & “Latest” TAB in WordPress
- How to fix template and image buffering issues on website [closed]
- How to create different woocommerce single_product.php pages for each product? [closed]
- Woocommerce attatch files and custom input meta to cart items and then to order
- Custom plugin translation not working
- WP-Members redirect if member ALREADY logged in
- WordPress plugin installation
- Get image URL from media library in input
- Adding a custom line of text to php code
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- plugins_url() incorrectly returns a url with www subdomain
- Adding a post shortcode to a page template?
- How to add an attribute to the body tag with a plugin?
- Creating an Exit Confirmation Popup
- Difference between register_block_type & wp.blocks.registerBlockType
- Suspicious google tag manager
- How to redirect Old Post URL to new Post and keep Old post Comments?
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Escape special characters in image link
- Ajax with jQuery UI dialog not working
- Dashboard Widget Form
- Why Better WP security plugin returns 418 I’m a Teapot “error”?
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- Plugin jQuery version VS Theme jQuery version: search for best practice
- New Plugin: Post update pushes a copy as a revision
- How to edit/delete single row items in a table on my own menu page
- Overide a function that is inside a plugin
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin