[wp-trac] [WordPress Trac] #59972: Clarify description of wp_script_add_data()
WordPress Trac
noreply at wordpress.org
Mon Nov 27 18:21:20 UTC 2023
#59972: Clarify description of wp_script_add_data()
--------------------------+-----------------------------
Reporter: crstauf | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: docs |
--------------------------+-----------------------------
The function description does not include `strategy` as a possible value
for `$key`. Suggest to adjust to indicate function is a wrapper for
`WP_Scripts::add_data()`, and then add possible values `conditional` and
`strategy` to `WP_Scripts::add_data()` function description or parameter
description.
> This documentation does not make it very clear that this can’t be used
for adding arbitrary values attributes to the script tag. It only supports
‘conditional’ or, more recently, a “strategy” value.
>
> For adding an alternate `type` attribute, for example, you’ll still need
to use older strategies like the `script_loader_tag` filter.
>
> [https://wordpress.stackexchange.com/questions/387674/wp-script-add-
data-doesnt-seem-to-work See this StackExchange post for details.]
Reported by @mrwweb via User Contributed Notes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59972>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list