[wp-trac] [WordPress Trac] #23590: Rename wp_localize_script

WordPress Trac noreply at wordpress.org
Fri Feb 22 22:58:10 UTC 2013


#23590: Rename wp_localize_script
-----------------------------+-------------------------
 Reporter:  bftrick          |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:                   |   Severity:  trivial
 Keywords:                   |
-----------------------------+-------------------------
 Hello,

 It's never made any sense to me to call a function that makes data from a
 php file accessible to a js file localize script. The name ''localize
 script'' makes me think of passing language specific data to a script.
 That is a valid and useful use of that method but it is only one use. It
 is similar to calling a spoon a cereal delivery system.

 If we can give it a better name then other developers will be better able
 to find it an use it instead of coming up with their own methods (like
 embedding JS in a php file; eek!).

 If you do a Google search for "pass php variable to js in wordpress" you
 get a lot of: "I didn't know how to do this until someone told me about
 this function". Here's some of the confusion:
 - [http://tosbourn.com/2011/08/wordpress/accessing-php-variables-from-
 within-javascript-under-wordpress/]
 - [http://ottopress.com/2010/passing-parameters-from-php-to-javascripts-
 in-plugins/]

 For backwards compatibility would could make the wp_localize_script
 function an alias of the new method.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23590>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list