Filter hook 'esc_xml'

in WP Core File wp-includes/formatting.php at line 4790

View Source

esc_xml

Filter Hook
Description
Filters a string cleaned and escaped for output in XML. Text passed to esc_xml() is stripped of invalid or special characters before output. HTML named character references are converted to their equivalent code points.

Hook Information

File Location wp-includes/formatting.php View on GitHub
Hook Type Filter
Line Number 4790

Hook Parameters

Type Name Description
string $safe_text The text after it has been escaped.
string $text The text prior to being escaped.

Usage Examples

Basic Usage
<?php
// Hook into esc_xml
add_filter('esc_xml', 'my_custom_filter', 10, 2);

function my_custom_filter($safe_text, $text) {
    // Your custom filtering logic here
    return $safe_text;
}

Source Code Context

wp-includes/formatting.php:4790 - How this hook is used in WordPress core
<?php
4785  	 * @since 5.5.0
4786  	 *
4787  	 * @param string $safe_text The text after it has been escaped.
4788  	 * @param string $text      The text prior to being escaped.
4789  	 */
4790  	return apply_filters( 'esc_xml', $safe_text, $text );
4791  }
4792  
4793  /**
4794   * Escapes an HTML tag name.
4795   *

PHP Documentation

<?php
/**
	 * Filters a string cleaned and escaped for output in XML.
	 *
	 * Text passed to esc_xml() is stripped of invalid or special characters
	 * before output. HTML named character references are converted to their
	 * equivalent code points.
	 *
	 * @since 5.5.0
	 *
	 * @param string $safe_text The text after it has been escaped.
	 * @param string $text      The text prior to being escaped.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/formatting.php
Related Hooks

Related hooks will be displayed here in future updates.