Plugin developers: The new wp_add_script_before() function has been removed from WordPress 3.3. (In r19573.)
In an IRC discussion it was discovered that it was not architected in an ideal way, and some inconsistencies were discovered relating to how scripts are loaded. For more see the end of #11520.
If you want to echo data to be used in your script, you can continue to use wp_localize_script() as before. Since it now uses json_encode(), it is a bit more flexible (can do nested arrays, for example). In 3.4 we hope to introduce a few more enhancements in this area.
(For those just tuning in, please note that wp_add_script_before() was originally new to 3.3, so this will not affect existing plugins.)
Andrew Nacin 8:54 pm on December 8, 2011 Permalink
For the previous 3.3 dev notes post, see http://wpdevel.wordpress.com/2011/12/07/whats-new-javascript-in-3-3/.
Andrew Nacin 9:29 pm on December 8, 2011 Permalink
The main issue with
wp_localize_script()is that it does decode HTML entities. This may not be ideal for certain forms of arbitrary data.wp_localize_script() now uses json_encode() which means a multidimensional array will now work for the passed data. And, HTML entity decoding only applies to the first level of the array.
So, don’t nest localized strings, and note that you can nest arbitrary data. We will definitely make this cleaner in 3.4.
arena 4:52 pm on December 9, 2011 Permalink
one question. is caching options items from options table using transients since 3.3 ?
Alex Mills 10:12 pm on December 9, 2011 Permalink
No, transients have always written to the options table unless an object cache was enabled.