sanitize_locale_name

The timeline below displays how wordpress function sanitize_locale_name has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: .19

/**
 * Strips out all characters not allowed in a locale name.
 *
 * @since 6.2.1
 *
 * @param string $locale_name The locale name to be sanitized.
 * @return string The sanitized value.
 */
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);
}