esc_html

Definition:
function esc_html( $text ) {}

Escaping for HTML blocks.

Parameters

  • string $text

Defined filters

  • esc_html
    apply_filters( 'esc_html', $safe_text, $text )

Source code

function esc_html( $text ) {

	$safe_text = wp_check_invalid_utf8( $text );

	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );

	return apply_filters( 'esc_html', $safe_text, $text );

}

1026

esc_attr__

Definition:
function esc_attr__( $text, $domain = 'default' ) {}

Retrieves the translation of $text and escapes it for safe use in an attribute.
If there is no translation, or the domain isn’t loaded, the original text is returned.

Parameters

  • string $text: Text to translate
  • string $domain: Optional. Domain to retrieve the translated text

Return values

returns:Translated text

Source code

function esc_attr__( $text, $domain = 'default' ) {

	return esc_attr( translate( $text, $domain ) );

}

1024

esc_attr_x

Definition:
function esc_attr_x( $single, $context, $domain = 'default' ) {}

Parameters

  • $single
  • $context
  • $domain

Source code

function esc_attr_x( $single, $context, $domain = 'default' ) {

	return esc_attr( translate_with_gettext_context( $single, $context, $domain ) );

}

1022

esc_attr_e

Definition:
function esc_attr_e( $text, $domain = 'default' ) {}

Displays translated text that has been escaped for safe use in an attribute.

Parameters

  • string $text: Text to translate
  • string $domain: Optional. Domain to retrieve the translated text

Source code

function esc_attr_e( $text, $domain = 'default' ) {

	echo esc_attr( translate( $text, $domain ) );

}

1020

esc_attr

Definition:
function esc_attr( $text ) {}

Escaping for HTML attributes.

Parameters

  • string $text

Defined filters

  • attribute_escape
    apply_filters( 'attribute_escape', $safe_text, $text )

Source code

function esc_attr( $text ) {

	$safe_text = wp_check_invalid_utf8( $text );

	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );

	return apply_filters( 'attribute_escape', $safe_text, $text );

}

1018