WordPress at a glance
function is not described

js_escape() WP 2.0.4

Deprecated from version 2.8.0. It is no longer supported and can be removed in future releases. Use esc_js() instead.

Escape single quotes, specialchar double quotes, and fix line endings.

The filter 'js_escape' is also applied by esc_js().

No Hooks.


String. Escaped text.


js_escape( $text );
$text(string) (required)
The text to be escaped.


  • See: esc_js()


Since 2.0.4 Introduced.
Deprecated Since 2.8.0 Use esc_js()

Code of js_escape() WP 5.7

function js_escape( $text ) {
	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
	return esc_js( $text );