esc_attr() corrupts json values
Normally, when one want to put strings to be used in javascript, esc_js is the right function, not esc_attr. The problem is that esc_js, according to docs: Escapes text strings for echoing in JS (bold mine). So, using with esc_js you obtain a string that can be safely echoed in js, not parsed: it’s not … Read more