8Nov
wordpress博客注册时支持中文名称
我自己测试过,不支持中文注册,我是使用露兜博客:(新版)让wordpress支持中文用户名的简便方法解决的。建议配合使用插件:Ludou custom register
在functions.php文件中添加下面代码:
function ludou_sanitize_user ($username, $raw_username, $strict) { $username = wp_strip_all_tags( $raw_username ); $username = remove_accents( $username ); // Kill octets $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities // 网上很多教程都是直接将$strict赋值false, // 这样会绕过字符串检查,留下隐患 if ($strict) { $username = preg_replace ('|[^a-z\p{Han}0-9 _.\-@]|iu', '', $username); } $username = trim( $username ); // Consolidate contiguous whitespace $username = preg_replace( '|\s+|', ' ', $username ); return $username; } add_filter ('sanitize_user', 'ludou_sanitize_user', 10, 3);
Today on history:
- 2018: 《橙红年代》小说看完了,开始看《铁器时代》(5)
除非特殊注明,本文版权归原作者所有,欢迎转载!转载请注明版权以及本文地址,谢谢。
转载保留版权:麦林风博客 >> wordpress博客注册时支持中文名称
本文地址:http://www.mailinfeng.com/27.html + 复制链接
转载保留版权:麦林风博客 >> wordpress博客注册时支持中文名称
本文地址:http://www.mailinfeng.com/27.html + 复制链接
Comments
目前有一条精彩评论