朱纯树博客
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支持用户名使用中文

评论 22

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

    Thanks for sharing your thoughts on wordpress.
    Regards

    tinyurl.com4个月前 (08-18)回复
  2. #29

    If you would like to improve your experience just keep visiting this website and be updated with the hottest news update posted
    here.

    tinyurl.com4个月前 (08-15)回复
  3. #28

    In fact no matter if someone doesn’t know after that its up to other people that they will assist, so here it
    happens.

    http://tinyurl.com4个月前 (08-13)回复
  4. #27

    Thanks for sharing your thoughts about wordpress.
    Regards

    tinyurl.com4个月前 (08-08)回复
  5. #26

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

    www.guiaservermu.com4个月前 (08-07)回复
  6. #25

    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.com4个月前 (08-03)回复
  7. #24

    Stunning story there. What occurred after? Thanks!

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