Filter hook 'sanitize_html_class'

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

View Source

sanitize_html_class

Filter Hook
Description
Filters a sanitized HTML class string.

Hook Information

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

Hook Parameters

Type Name Description
string $sanitized The sanitized HTML class.
string $classname HTML class before sanitization.
string $fallback The fallback string.

Usage Examples

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

function my_custom_filter($sanitized, $classname, $fallback) {
    // Your custom filtering logic here
    return $sanitized;
}

Source Code Context

wp-includes/formatting.php:2446 - How this hook is used in WordPress core
<?php
2441  	 *
2442  	 * @param string $sanitized The sanitized HTML class.
2443  	 * @param string $classname HTML class before sanitization.
2444  	 * @param string $fallback  The fallback string.
2445  	 */
2446  	return apply_filters( 'sanitize_html_class', $sanitized, $classname, $fallback );
2447  }
2448  
2449  /**
2450   * Strips out all characters not allowed in a locale name.
2451   *

PHP Documentation

<?php
/**
	 * Filters a sanitized HTML class string.
	 *
	 * @since 2.8.0
	 *
	 * @param string $sanitized The sanitized HTML class.
	 * @param string $classname HTML class before sanitization.
	 * @param string $fallback  The fallback string.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/formatting.php
Related Hooks

Related hooks will be displayed here in future updates.