彻底解决WP中文标签404错误

找到网站个目录下文件夹:wp-include文件夹下的class-wp.php,定位此代码段(V3.6在144行) 老高温馨提示:使用本教程前请备份数据库及相关文件if ( isset($_SERVER['PATH_INFO']) ) $pathinfo = $_SERVER['PATH_INFO']; else $pathinfo = ''; $pathinfo_array = explode('?', $pathinfo); $pathinfo = str_replace("%", "%25", $pathinfo_array[0]); $req_uri = $_SERVER['REQUEST_URI']; 修改为 if ( isset($_SERVER['PATH_INFO']) ) $pathinfo = mb_convert_encoding($_SERVER['PATH_INFO'], "UTF-8", "GBK"); else $pathinfo = ''; $pathinfo_array = explode('?', $pathinfo); $pathinfo = str_replace("%", "%25", $pathinfo_array[0]); $req_uri = mb_convert_encoding($_SERVER['REQUEST_URI'], "UTF-8", "GBK"); 至此,wordpress已经学会读中文了。 还有一种解决方式,即给每一个标签都设置一个英文别名,这样设置的标签还是不能使用中文,可以使用下面的代码将所有的标签格式化: <?php header("Content-type: text/html; charset=utf-8"); // 修改:LAOGAO https://blog.phpgao.com/ define('MYSQL_HOSTNAME', 'localhost'); define('MYSQL_USERNAME', 'yourusername'); define('MYSQL_PASSWORD', 'yourpassword'); define('MYSQL_DATABASE', 'yourdatabase'); define('MYSQL_TABLEPRE', 'wp_'); // 表前缀 error_reporting(E_ALL); ini_set('display_errors', 'On'); $link = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD); if (!...

March 19, 2014 · 1 min · Me