Works only if the script has already been registered. Accepts an associative array $l10n and creates a JavaScript object: "$object_name": {
key: value,
key: value,
...
}
Parameters
$handlestring
Script handle the data will be attached to.
$object_namestring
Name for the JavaScript object. Passed directly, so it should be qualified JS variable. Example: '/[a-zA-Z0-9_]+/'.
$l10narray
The data itself. The data can be either a single or multi-dimensional array.
Return
bool
True if the script was successfully localized, false otherwise.
Uses · 1
wp_scripts()Initializes $wp_scripts if it has not been set.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Parameter $l10n retyped from array to untyped.verified against source
2.2.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/functions.wp-scripts.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.