Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#31273 closed enhancement (duplicate)

Register JavaScript templates with wp_enqueue_script()

Reported by: danielbachhuber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: needs-patch
Focuses: Cc:


This would make it much easier to conditionally include templates, instead of including them everywhere all the time.

Change History (3)

#1 @rmccue
5 years ago

This could almost be done via WP_Scripts::add_data, however there's no way to set the type or ID on that. (You could build a plugin solution via the script_loader_tag filter too.)

+1 on extending the data system to support that, +0 on adding support for templates specifically (not sure we need the full complexity there).

#2 @Funkatronic
5 years ago

Ticket #31281 is a possible duplicate (with a solution)

#3 @danielbachhuber
5 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #31281.

Note: See TracTickets for help on using tickets.