在WordPress上添加中文用户时报错说不支持中文,得到如下错误:
错误:请填写用户名。
错误:此用户名包含无效字符,请输入有效的用户名。
修改源代码的解放方法:
编辑wp-includes/formatting.php,找到函数function sanitize_user( $username, $strict = false ) 在其下面增加一行$strict = false;
如下:
function sanitize_user( $username, $strict = false ) {
$strict = false;//加入此行
$raw_username = $username;
$username = wp_strip_all_tags( $username );
$username = remove_accents( $username );
注意:每次WordPress升级的之后,还需要做同样的处理。
本文介绍了解决WordPress中添加中文用户名时报错的问题,通过修改源代码中的sanitize_user函数,允许使用中文作为用户名。
910

被折叠的 条评论
为什么被折叠?



