WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #21547, comment 2


Ignore:
Timestamp:
08/11/12 07:23:22 (2 years ago)
Author:
gkb6891
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21547, comment 2

    v1 v2  
    66It's not necessarily for internationalization. In my case, at Automattic, the WordPress.com plugin I was working on uses wp_localize_script to pass dynamic properties to a static javascript file.  
    77 
    8 Here's the specific scenario: we run multiple a/b tests each of which needs some dynamic parameters passed to a static javascript file. Each of these a/b enqueues the static javascript file if it's not already been enqueued. 
     8Here's the specific scenario: we run multiple a/b tests each of which needs some dynamic parameters passed to a static javascript file. Each of these a/b tests enqueues the static javascript file if it's not already been enqueued. 
    99 
    1010The current implementation of wp_localize_script simply creates a new JS object each time it's called. A developer (like me in this case) might want to modify the existing JS object instead of creating a new one. It's easy to simply delocalize the script by passing the handle and calling wp_localize_script one more time.