The function wp_register_script
has a parameter called $in_footer
. Setting this to false will add the script to the head.
wp_register_script( string $handle, string|bool $src, array $deps = array(), string|bool|null $ver = false, bool $in_footer = false )
In addition, if you deregister jquery, you can manually add the script in your head above wp_head()
. This is generally not recommended.
Related Posts:
- Is there a way to enable Cross-Origin Resource Sharing for WordPress’ ajaxurl?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- Move WordPress native javascript to bottom of page?
- RequireJS in custom theme. Working Example
- How to get a jQuery script to run on a page?
- Including javascript for a shortcode
- Asynchronous Javascript Loaders
- wp_enqueuescript won’t load in footer even with true value set?
- How wp_enqueue_script works?
- How do I get my page to load the jQuery UI Effects library?
- Script won’t execute in the media manager
- How to properly add Bootstrap and JQuery Javascripts?
- Enqueuing javascript files
- Searching multiple tags and adding jQuery dependant script onto page template?
- Plugin Scripts no loading on options page
- How to enque js script in footer that are not in .js file?
- Loading scripts on a single page plants the script in the footer
- Using WP functions inside javascript
- Including Older Version of jQuery for IE7/IE8
- How To Include JavaScript Files Only In Single Posts?
- JavaScript code do not works on online server
- Bootstrap with separate js File
- How to add JS snippet before closing tag?
- Enqueue javascript that inserts custom php widget into jQuery-constructed div
- How to Run a jQuery Script after a Javascript Script has Finished in WordPress
- javascript not loading in wordpress
- bootstrap-slider.js by seiyria not working in wordpress
- Use WordPress Built In Jquery
- How to set time delay in javascript
- JavaScript: filter() for Objects
- Rotate image with javascript
- How to make a simple image upload using Javascript/HTML
- Enable & Disable a Div and its elements in Javascript
- Javascript – ERR_CONTENT_LENGTH_MISMATCH
- force enqueue script to be first in order of prominence
- Ajax call does not activate callback function
- Add `datetimepicker` to form
- Use js script from one plugin in another plugin
- Ajax not firing properly using Firefox, but works in Chrome
- wp_enqueue_script won’t load in header?
- jQuery Hoverintent plugin in TwentyEleven Menu [closed]
- Adding jQuery dependency prevents my script from enqueuing/loading
- Gravity Forms not loading under https, jQuery is not defined
- Can’t move jQuery to footer
- wp_enqueue_scripts hook is not being called
- wp_ajax unauthenticated and authenticated
- WordPress ajax function parameter value not being passed
- Is it safe to include a javascript file in a template’s php file?
- Including Javascript options
- Add a Fancybox automatically to post type “post” images
- enqueued script with jquery dependency not getting jquery
- WordPress customizer refresh screen after save
- Creating multiple enclosing shortcodes and fixing JS issues on click
- Enqueue Google CDN jQuery in Footer
- How to undo deregister script and use local versions?
- ‘jQuery is not defined Error’ appearing in load-scripts.php
- JSON output returns page source code [closed]
- Dealing with a library that depends on jQuery
- start.js:45TypeError: Not enough arguments on Safari [closed]
- I want to import my Json file into a custom made display-modal. How do i link my Json file?
- Help with a jQuery Carousel
- Fall Back Google CDN in JavaScript
- wp_enqueue doesn’t work
- $.browser Undefined Seemingly Causing Faulty Page Display
- Trouble enqueueing jquery with custom theme
- I have an old version of jQuery showing up. How do I figure out where it is coming from?
- registering new jQuery after wp_deregister_script() not working
- Search input area autogrow – how?
- Get value of selected option in select field in a WordPress form
- Required radio button does not validate in form, when clicked through Javascript/jQuery
- jQuery plugin not loading
- Screen Options JavaScript Code
- Is there some jQuery conflict here?
- Theme has superfish – how to add supersubs?
- Best way to add some custom javascript using jquery to a child theme
- WordPress not showing jQuery
- Add JQuery As Code Snippet
- Form validation before submitting
- Get ajaxForm response value
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- JQuery toggle in Visual Composer
- WP Media Uploader modal conflicts with Bootstrap modal
- jQuery search function not running in WordPress but running locally (fiddle)
- JQuery Login Dropdown not functioning in theme
- Javascript function to switch out images
- Can’t seem to get JQuery working (wordpress plugin)
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Ajax Request with jQuery not happening
- jQuery does not appear to be enqueued on static homepage
- Uncaught TypeError: Object [object Object] has no method ‘dialog’
- wp_register_script Question
- Need help with adding jQuery script to WP and calling script to page
- How to make jQuery load AFTER plugin’s script?
- Monarch JS has not been loaded. After changing the $dep parameter, it start being loaded
- Theme now uses require.js and enqueue script no longer works
- jQuery issue and wp_enqueue_script
- Carousel Hover Image
- Individual Pages are loading halfway down
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]