[wp-trac] [WordPress Trac] #24197: wp_localize_script() doesn't work on admin_enqueue_scripts action

WordPress Trac noreply at wordpress.org
Thu May 2 13:12:52 UTC 2013


#24197: wp_localize_script() doesn't work on admin_enqueue_scripts action
--------------------------+--------------------
 Reporter:  IcyPixels     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.6
Component:  General       |     Version:  trunk
 Severity:  major         |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+--------------------

Comment (by kovshenin):

 If you'd like to make some data available to js from php, don't have a
 particular script file to enqueue that uses it, and don't need the
 dependency management `WP_Dependencies` gives you, you might as well just
 print your array with `json_encode` in `wp_head`, `wp_footer` or inline.
 Attaching your data to the `jquery` handler with `wp_localize_script` is a
 bad idea.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24197#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list