WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/js escape


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.

Contents

Description

Escape single quotes. Convert double quotes. Fix line endings.

The filter 'js_escape' is also applied here.

js_escape has been deprecated since 2.8. Use esc_js instead.

Usage

<?php js_escape$text ?>

Parameters

$text
(string) (required) The text to be escaped.
Default: None

Return Values

(string) 
Escaped text.

Examples

Notes

Change Log

Since: 2.0.4

Source File

js_escape() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.