[wp-trac] [WordPress Trac] #20558: allow wp_localize_script data to be added to existing objects

WordPress Trac noreply at wordpress.org
Tue Nov 4 06:10:56 UTC 2014


#20558: allow wp_localize_script data to be added to existing objects
--------------------------------------+------------------------------
 Reporter:  ryanve                    |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Script Loader             |     Version:  3.3
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback 2nd-opinion  |     Focuses:
--------------------------------------+------------------------------

Comment (by here):

 Add a 4th argument for object name?

 {{{
 wp_localize_script('gimme-objects', 'bar', array( "a" => 1 ), 'foo');

 var foo = foo || {};
 foo.bar = foo.bar || {"a" : 1};
 }}}

 See also, this hack: https://gist.github.com/here/8c908f00fd3f45e76805

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20558#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list