I try to pass a javascript array to a shortcode, but it seems to be sanitized/escaped. For example this character "[" generate that "`{`". What is the function to retrieve original data ?
Here is a shortcode example :
[shortcode jsarray="[{start:"19:30",end:"21:00",color:'#d99694'},{start:"20:00",end: "21:30",color:'#d99694'},],"]
Some text
[/shortcode]
Here is my shortcode render function :
public function render_html($atts,$content)
{
$atts = shortcode_atts(array('jsarray' =>''), $atts);
$jsarray=$atts['jsarray'];
if(empty($jsarray))
{
return;
}
ob_start(); ?>
<div data="<?php echo base64_encode($jsarray) ?>">
<?php echo $content; ?>
</div>
<?php
return ob_get_clean();
}
EDIT : Here is the result in shortcode_atts function :
`{`{``start``:``19:30``, ``end``:``21:00``, ``color``:``#d99694``}, {``start``:``19:30``, ``end``:``21:00``, ``color``:``#d99694``}`}`