I have problem with wp_localize_script
, That I cannot get boolean and int as variable
wp_enqueue_script( 'helloworld' , 'helloworld.js', false, '1.0.0', true);
$site_config = array();
$site_config['boo'] = (bool)true;
$site_config['number'] = (int)1;
wp_localize_script( 'helloworld' , 'site_config' , $site_config );
Why I getting :
var site_config = {"boo":"1","number":"1"};
Why not :
var site_config = {"boo":true,"number":1};
- WordPress 4.6 (latest)
- PHP 5.6.10
Does not it fixed ? https://core.trac.wordpress.org/ticket/25280 , I do anything wrong or missing something ?