朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

让wordpress支持用户名使用中文

适用于WP5.6中文版,亲测有效。

打开文件 【网站根目录/wp-includes/formatting.php】,查找到sanitize_user函数,将其中的

2106-2108行:
if ( $strict ) {
  $username = preg_replace( ‘|[^a-z0-9 _.-@]|i’, ”, $username );
 }
修改为:
if ( $strict ) {
  $username = preg_replace( ‘|[^a-zp{Han}0-9 _.-@]|iu‘, ”, $username );
 }

需要修改的,见红字。

以后每次升级wordpress都要设置一下。

赞(1) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » 让wordpress支持用户名使用中文

评论 19

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #30

    Thanks for sharing your thoughts about wordpress.
    Regards

  2. #29

    Fastidious response in return of this query with solid arguments and telling all regarding that.

  3. #28

    Hello to every body, it’s my first pay a quick visit of this weblog; this
    website consists of awesome and really excellent data for readers.

    tinyurl.com1周前 (08-03)回复
  4. #27

    Stunning story there. What occurred after? Thanks!

    http://tinyurl.com3个月前 (05-10)回复