[wp-trac] [WordPress Trac] #48098: ReferenceError: jQuery is not defined even if it is enqueued
WordPress Trac
noreply at wordpress.org
Sat Sep 21 12:07:34 UTC 2019
#48098: ReferenceError: jQuery is not defined even if it is enqueued
---------------------------+-----------------------------
Reporter: KestutisIT | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 5.2.3
Severity: major | Keywords: needs-patch
Focuses: javascript |
---------------------------+-----------------------------
So I have a template in a plugin with:
{{{#!php
<?php
// Scripts
wp_enqueue_script('jquery');
?>
<div class="great-plugin-wrapper">
<!--- BUNCH OF HTML -->
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.responsive-deals-slider').slick({
// Bunch of javascript
});
});
</script>
}}}
And I'm getting 'ReferenceError: jQuery is not defined' error in console
even if it is enqueued in HTML before using.
In source code it says jQuery is loaded late in footer:
{{{
<script type='text/javascript' src='http://localhost/GitHub/web1/sub1/wp-
includes/js/jquery/jquery.js?ver=1.12.4-wp'></script>
}}}
. Why? Does something changed in WordPress in recent months regarding
this, and why so? It was working at least 6 months ago.
And how to make sure jQuery is not loaded in the footer, or that
{{{ jQuery(document).ready( }}} would work?
I'm using:
1. Twenty Nineteen theme
2. Multisite
3. Guttenberg
4. Newest WordPress
5. Plugin's shortcode
6. Just one plugin and one theme.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48098>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list