Escape single quotes, specialchar double quotes, and fix line endings.
The filter ‘js_escape’ is also applied by esc_js() .
$textstringrequired
function js_escape( $text ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
return esc_js( $text );
}
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/js_escape