[wp-trac] [WordPress Trac] #25280: wp_localize_script unexpectedly converts numbers to strings

WordPress Trac noreply at wordpress.org
Thu Mar 2 16:34:18 UTC 2017


#25280: wp_localize_script unexpectedly converts numbers to strings
------------------------------------+-----------------------------
 Reporter:  adamsilverstein         |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Script Loader           |     Version:  3.2
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  javascript
------------------------------------+-----------------------------

Comment (by adamsilverstein):

 What about leaving `wp_localize_script` as is for backward compatibility
 and introducing a new helper with better behavior?

 [attachment:25280.3.diff]
 * Add a new helper function for passing data from PHP to JS:
 `wp_pass_data_to_script`
 * Includes passing tests from this ticket and #29722
 * Includes multidimensional array html entity decoding from #29722

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


More information about the wp-trac mailing list