Localizes a script, but only if script has already been added. Can also be used to include arbitrary Javascript data in a page.

learn more… | top users | synonyms

2
votes
2answers
233 views

Use wp_localize_script for non existing script

Task: What I'm trying to do I'm fetching data via the WP Http API from a remote server. The data I'm getting back is JSON encoded. In one of my methods, I'm converting them back and then push it into ...
3
votes
1answer
124 views

How to intercept already localized scripts

If a plugin uses some script (prominent example: jQuery UI Datepicker), but you're not happy with how the script renders the output, then there're two possibilities: 1. Unregister the script > Add ...
1
vote
1answer
595 views

How to get the post ID when creating JS variables with localize_script

how do you set the current post ID as a JS variable with localize_script? It seems like the $post variable isn't availible in the functions.php file. When is it created? Do i have to add localize ...
0
votes
2answers
57 views

jQuery Autocomplete not working with wp_localize_script

Bit of background: I am building an autocompleting-search box for a list of Trades (a Custom Taxonomy). I asked this question and very helpfully got a much better understanding of how WordPress and ...
0
votes
1answer
195 views

Can't seem to get wp_localize_script to work

This is my code: wp_enqueue_script('ms_ajax_localized'); wp_localize_script( 'ms_ajax_localized', 'MS_Ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nextNonce' => ...