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

WordPress Trac noreply at wordpress.org
Fri Apr 26 02:03:29 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:  Awaiting Review
Component:  General            |     Version:  trunk
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch 2nd-opinion => reporter-feedback


Comment:

 The snippet is a bit confusing. Are you passing data to a modified version
 of `jquery.js`?

 Seems like your JS file is trying to use `icy_ajax` without checking if it
 was added.

 My steps:
 1. Enqueued my own script and changed `'jquery'` in your snippet to that
 script handle.
 2. Went to Edit Post screen.
 3. `alert( icy_ajax.post_id )` prints the post ID, as expected.

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


More information about the wp-trac mailing list