wp_localize_script() and JavaScript namespaces
The way wp_localize_script() is supposed to be used is for that 2nd argument to be your namespace. Then you put an array as the 3rd argument for the values: wp_localize_script( ‘my-script’, ‘namespace_name’, array( ‘var_name’ => $var, ) ); Now you can access the variable in the script with namespace_name.var_name. If you also use the namespace … Read more