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
207 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
97 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
452 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 ...