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

WordPress Trac noreply at wordpress.org
Thu Sep 10 12:29:50 UTC 2020


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

Comment (by nerrad):

 @andraganescu "now there is" refers to usage of `wp_add_inline_script` as
 the alternative. You can find more about usage of this function here:
 https://developer.wordpress.org/reference/functions/wp_add_inline_script/.

 It looks like Ian added a comment on the `wp_localize_script` page
 clarifying its use too (and pointing to `wp_add_inline_script` for
 arbitrary data -
 https://developer.wordpress.org/reference/functions/wp_localize_script/#comment-3213).
 However, if you're planning on updating the main documentation that's a
 great idea!

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


More information about the wp-trac mailing list