I have the following code in the javascript which outputs the date(s). With backslash for that, I'm replacing those strings with the str_replace
to remove backslash, but I can't sanitize that using any escaping function like esc_js
.
Stored Days Array
array (size=2)
0 => string '4/7/2018' (length=8)
1 => string '11/18/2017'(length=10)
The code
var disabledDays = <?php echo str_replace( '\\/', '/', wp_json_encode( $iva_disable_days ) ); ?>;
Tried Code which is not working
var disabledDays = <?php echo esc_js( str_replace( '\\/', '/', wp_json_encode( $iva_disable_days ) ) ); ?>;
Result Output
var disabledDays = ["4/7/2018","11/18/2017"];
How do I sanitize the above section in The Code