How to use wp_localize_script in a WordPress page other than functions.php?

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.

https://codex.wordpress.org/Function_Reference/wp_localize_script

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)