Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

wp_localize_script()

3 tags 1 category

wp_localize_script() — Localizes a script. 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, … }

Inputs: $handle (string): Script handle the data will be attached to. $object_name (string): Name for the JavaScript object. Passed directly, so it should be qualified JS variable. Example: ‘/[a-zA-Z0-9_]+/’.

Returns bool: True if the script was successfully localized, false otherwise.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…