On this page
tag_escape( string $tag_name ): string
Escapes an HTML tag name.
Parameters
$tag_namestring Required
Return
string
Source
File: wp-includes/formatting.php. View all references
function tag_escape( $tag_name ) {
$safe_tag = strtolower( preg_replace( '/[^a-zA-Z0-9_:]/', '', $tag_name ) );
/**
* Filters a string cleaned and escaped for output as an HTML tag.
*
* @since 2.8.0
*
* @param string $safe_tag The tag name after it has been escaped.
* @param string $tag_name The text before it was escaped.
*/
return apply_filters( 'tag_escape', $safe_tag, $tag_name );
}
Hooks
- apply_filters( 'tag_escape',
string $safe_tag ,string $tag_name ) -
Filters a string cleaned and escaped for output as an HTML tag.
Related
Uses
| Uses | Description |
|---|---|
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| get_tag_regex() wp-includes/functions.php | Returns RegEx body to liberally match an opening HTML tag. |
| gallery_shortcode() wp-includes/media.php | Builds the Gallery shortcode output. |
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/tag_escape