Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#40485 new feature request

Add function for retrieving metadata from registered script

Reported by: desrosj's profile desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2
Component: Script Loader Keywords: has-patch has-unit-tests needs-testing
Focuses: Cc:


There is currently a function for adding metadata to a registered script (wp_script_add_data()), but no function for retrieving that metadata.

My use case
I am trying to write a unit test for a function in my plugin that generates data and calls wp_localize_script() to ensure the expected data is passed for localization.

Other Use Cases
I could see other use cases where a plugin could change a metadata value or add a new key if a certain value is assigned to a certain key.

Attachments (2)

40485.diff (2.6 KB) - added by desrosj 7 years ago.
Adds wp_script_get_data() with unit tests.
40485.2.diff (2.6 KB) - added by desrosj 7 years ago.
Refreshed patch.

Download all attachments as: .zip

Change History (5)

7 years ago

Adds wp_script_get_data() with unit tests.

#1 @desrosj
7 years ago

  • Keywords has-patch has-unit-tests needs-testing dev-feedback added
  • Type changed from defect (bug) to feature request

#2 @desrosj
7 years ago

  • Keywords dev-feedback removed

#3 @johnbillion
7 years ago

  • Version changed from trunk to 4.2

7 years ago

Refreshed patch.

Note: See TracTickets for help on using tickets.