Strips out all characters not allowed in a locale name.
Parameters
$locale_name
stringrequired- The locale name to be sanitized.
Source
function sanitize_locale_name( $locale_name ) {
// Limit to A-Z, a-z, 0-9, '_', '-'.
$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $locale_name );
/**
* Filters a sanitized locale name string.
*
* @since 6.2.1
*
* @param string $sanitized The sanitized locale name.
* @param string $locale_name The locale name before sanitization.
*/
return apply_filters( 'sanitize_locale_name', $sanitized, $locale_name );
}
Hooks
- apply_filters( ‘sanitize_locale_name’,
string $sanitized ,string $locale_name ) Filters a sanitized locale name string.
Changelog
Version | Description |
---|---|
6.2.1 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.