sanitize_locale_name

函数
sanitize_locale_name ( $locale_name )
参数
  • (string) $locale_name The locale name to be sanitized.
    Required:
返回值
  • (string) The sanitized value.
定义位置
相关方法
sanitize_file_namesanitize_termsanitize_metasanitize_titlesanitize_category_field
引入
6.2.1
弃用
-

删除本地名称中不允许出现的所有字符。

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 );
}

常见问题

FAQs
查看更多 >