#59865 closed defect (bug) (invalid)
wp_enqueue_script problem
| Reported by: | jareksol | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Script Loader | Version: | 6.4 |
| Severity: | normal | Keywords: | close |
| Cc: | Focuses: |
Description
After upgrade to 6.4.1 version I have a problem with printing scripts tag in footer.
My code is very simple:
wp_enqueue_script('sage/home.js', asset_path('scripts/home.js'), ['jquery'], null, true);
The output is:
<script type="text/javascript" src="https://mysite.dvl.to/wp-content/themes/sage/dist/scripts/home_58192a8e.js' defer='defer" id="sage/home.js-js"></script>
The result is script is not loading.
I have found temporary solution in wp-includes/class-wp-scripts.php file. I have commented line 412 which is:
$src = esc_url_raw( apply_filters( 'script_loader_src', $src, $handle ) );
Can you please fix this bug?
Change History (3)
#3
@
3 years ago
- Milestone Awaiting Review
- Resolution → invalid
- Status new → closed
Also not able to reproduce this. Also wondering what's the asset_path() function used in the example, there's no such function in WP core. Seems it may be related to the problem?
Agree with @jorbin that this is most likely caused by a plugin or theme. Closing as invalid, please feel free to reopen with more details and a way to reliably reproduce.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi @jareksol,
I am not able to replicate this on a default install. From the looks of the tag that is printed, something is attempting to inject the
deferloading strategy. This is likely a plugin or some code in your theme and is not the supported way to adjust the loading strategy.See: https://make.wordpress.org/core/2023/10/17/script-loading-changes-in-wordpress-6-4/ and https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/
I believe this should be closed as
invalidas it is not a bug in WordPress Core.