[wp-hackers] congratulations on wp_localize_script

Otto otto at ottodestruct.com
Tue Mar 13 23:26:52 UTC 2012


Oh, never mind. That's about supporting Objects as well, which it
currently doesn't do. Arrays should work fine, I think. Probably have
since the whole thing was switched to using json_encode about 3 months
ago.

-Otto



On Tue, Mar 13, 2012 at 6:24 PM, Otto <otto at ottodestruct.com> wrote:
> To the best of my knowledge, that hasn't actually been added yet.
> There's some discussion on it though:
> http://core.trac.wordpress.org/ticket/19825
>
> -Otto
>
>
>
> On Tue, Mar 13, 2012 at 5:08 PM, Leo germani <leogermani at gmail.com> wrote:
>> Hi,
>>
>> I just wanted to congratulate whoever was responsible for the recent
>> changes on wp_localize_script function.
>>
>> This is the kind of improvement few people talk about, and I bet many
>> people are wondering what the hell happened:
>>
>> wp_localize_script used to send all variables as javascript strings. And if
>> you tried to send an array, you would get an string "array" on the
>> javascript side.
>>
>> Now you can pass strings, integers, booleans, arrays, arrays with keys,
>> multi dimensional arrays, etc. and you will get just the same thing on your
>> javascript. This is beautiful.
>>
>> I wanted to let you know I noticed it! And Im very happy with it!
>>
>> Thank you very much
>>
>> Leo,,
>>
>> --
>> leogermani.com.br
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list