Hot answers tagged


You cannot use wp_localize_script in page template. You have to use it in functions.php or your custom plugin, after you register your script, which is usually in the wp_enqueue_scripts action.


How can i return a PHP value from a WordPress page to a JQuery function? Use wp_localize_script to create an object and pass it to the JavaScript.


The following is the solution I came up with: <div id="selection1"> <div id="dropdown1"> <form id="choice1" action="<?php bloginfo('url'); ?>" method="get"> <?php $select = wp_dropdown_pages( array( 'post_type' => 'page', '...

Only top voted, non community-wiki answers of a minimum length are eligible