Make WordPress Core

Opened 4 months ago

Closed 3 months ago

Last modified 3 months ago

#59865 closed defect (bug) (invalid)

wp_enqueue_script problem

Reported by: jareksol's profile jareksol Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.4
Component: Script Loader Keywords: close
Focuses: Cc:


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="; defer=&#039;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)

#1 @jorbin
4 months ago

  • Keywords close added
  • Severity changed from major to normal

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 defer loading strategy. This is likely a plugin or some code in your theme and is not the supported way to adjust the loading strategy.

See: and

I believe this should be closed as invalid as it is not a bug in WordPress Core.

#2 @ironprogrammer
4 months ago

#59864 was marked as a duplicate.

#3 @azaozz
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to 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.

Last edited 3 months ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.