Home >CMS Tutorial >WordPress >How to solve wordpress tag error problem

How to solve wordpress tag error problem

藏色散人
藏色散人Original
2023-02-03 14:03:132193browse

Solution to wordpress tag error: 1. Find and open the "class-wp.php" file in the "wp-includes" directory of wordpress; 2. Modify the content to "$pathinfo = isset( $_SERVER ['PATH_INFO'] )?mb_convert_encoding($_SERVER['PATH_INFO'],'utf-8','GBK') : '';".

How to solve wordpress tag error problem

The operating environment of this tutorial: Windows 10 system, wordpress version 4.7.2, Dell G3 computer.

How to solve wordpress tag error problem?

The perfect solution to wordpress Chinese title/tag 404

When I was writing an article, I found that clicking on the Chinese tag label/or article title on the right side of this site, A 404 error page will pop up, so I decided to solve it: the perfect way to solve the Chinese tag 404 in WordPress (version 4.7.2). I will also share the method here, so that everyone does not need or encounter the same problem and take a detour!

The tutorial on how to solve the problem of WordPress Chinese tag 404 is as follows:

Solution to the problem that WordPress cannot open articles with Chinese tag links (the server needs to support UTF-8, and there is no need to modify the file to support Chinese links.)

First find the class-wp.php file in the wp-includes directory of wordpress and make the following modifications to solve the problem perfectly.

Code:

//wp-includes/class-wp.php 178 行:(版本不同可能行号不同,直接搜索即可)
 
$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
//修改为:
$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? mb_convert_encoding($_SERVER['PATH_INFO'], 'utf-8', 'GBK') : '';
//wp-includes/class-wp.php 183 行:(版本不同可能行号不同,直接搜索即可)
list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
//修改为:
list( $req_uri ) = explode( '?', mb_convert_encoding($_SERVER['REQUEST_URI'], 'utf-8', 'GBK') );

Change and save to perfectly solve the problem of wordpress Chinese tag 404!

Recommended learning: "WordPress Tutorial"

The above is the detailed content of How to solve wordpress tag error problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn