sanitize_html_class ( $class, $fallback = '' )

  • (string) class The classname to be sanitized
  • (string) fallback Optional. The value to return if the sanitization ends up as an empty string. Defaults to an empty string.
  • (string) The sanitized value
Defined at:


Sanitizes an HTML classname to ensure it only contains valid characters.Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty string then it will return the alternative value supplied.

Related Functions

sanitize_hex_color, sanitize_meta, sanitize_term, sanitize_term_field, sanitize_email

Top Google Results

User discussions

wpseek mobile