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

WordPress Trac noreply at wordpress.org
Thu May 23 14:01:41 UTC 2019


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

Comment (by nerrad):

 I'd like to recommend this trac ticket get closed.  `wp_add_inline_script`
 should be used for passing data to javascript and preserving type.
 `wp_localize_scripts` should only be used for its original intent
 (''localizing'' scripts) which was abused over the years for passing other
 data because at the time there was nothing more useful (now there is).

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


More information about the wp-trac mailing list