Make WordPress Core

Opened 3 months ago

Closed 12 hours ago

#51709 closed feature request (duplicate)

Feature request / Enhancement: Script version dependencies

Reported by: keraweb Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: dev-feedback needs-design
Focuses: Cc:


I couldn't find a similar ticket though I can hardly imagine no-one has asked this before.
Anyhow, sorry if this is duplicate!

Currently you can add script dependencies, which is already working very neat.
However, I think enhancing this feature with version dependencies would greatly enhance this part and allow plugins to re-use existing scripts if the version params support them.
This could also prevent some plugins from adding duplicate scripts.



    array (
        'jquery' => '^1.12', // Any 1.x version higher than 1.12.
        'bootstrap' => '4.*', // Any 4.x version

Checking if version exists:

wp_script_is( 'myscript', 'registered', '>3' );

This would also allow registering multiple scripts under the same handle but on a different version.

I can imagine a next step would be a script/asset manager through the UI where you could optionally dequeue some redundant scripts. For example, different versions of Bootstrap.

Change History (1)

#1 @SergeyBiryukov
12 hours ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome back to WordPress Trac!

Thanks for the ticket, we're already tracking this feature request in #47285.

Note: See TracTickets for help on using tickets.