Warning: This function has been deprecated. Use esc_html() instead.

wp_specialchars() WordPress Function

The wp_specialchars() function is a WordPress function that converts special characters to HTML entities. This function is useful for displaying text on a web page that may contain characters that are not allowed in HTML.

wp_specialchars( string $text, string $quote_style = ENT_NOQUOTES, false|string $charset = false, false $double_encode = false ) #

Legacy escaping for HTML blocks.


Description

Top ↑

See also


Top ↑

Parameters

$text

(string)(Required)Text to escape.

$quote_style

(string)(Optional)Unused.

Default value: ENT_NOQUOTES

$charset

(false|string)(Optional)Unused.

Default value: false

$double_encode

(false)(Optional)Whether to double encode. Unused.

Default value: false


Top ↑

Return

(string) Escaped $text.


Top ↑

Source

File: wp-includes/deprecated.php

function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
	if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
		return _wp_specialchars( $text, $quote_style, $charset, $double_encode );
	} else {
		return esc_html( $text );
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More