For SEO, we often need to optimize wordpress. today we will share with you a method to remove category and reduce the directory depth. WordPress has many methods to remove & ldquo; category & rdquo; from the fixed link. here we will introduce three simple and easy-to-use methods to serve as an example. First, set it in a fixed link in the Wordpress background; second, modify the Wordp
For SEO, we often need to optimize wordpress. today we will share with you a method to remove category and reduce the directory depth. WordPress has many ways to remove "category" from fixed links. here we will introduce three simple and easy-to-use methods, which can be used as an example. One is set in the fixed link in the Wordpress background; the other is implemented by modifying the Wordpress core function; and the third is implemented through the cool Wenbo Wordpress plug-in. For details about how to download the plug-in, refer to the original article and download it with one click (there is a link below )!
Method/step
- Modify the fixed link settings and remove the category link prefix category.Log on to your Wordpress background and open the fixed link/permanent link settings. In "optional settings", enter the halfwidth character "." in "category address prefix". Save the prefix "category. Advantage: easy to set and suitable for all users. Applicable to first-built blogs or blogs that are just planning to use fixed links/permanent links. You do not need to modify the code, but do not have to worry about the upgrade. you do not need to use plug-ins to increase the running burden.
Disadvantage: the original link cannot be opened and error 404 is displayed. You should be very careful when you are well indexed by search engines or when there are many external links in the classified links. Do not lose a lot of external links and weights because of simple operations, saving time and effort.
After rewriting is enabled, the corresponding article cannot be found under the category and tag, so it is best to shorten it.
- Remove the category prefix category with the Wordpress plug-in
1. WP No Category Base: the wordpress plug-in developed by iDope to remove category from Category links in fixed links. it has been downloaded for nearly 50 thousand times. After the plug-in is installed and enabled, the original category address is redirected to 301, which is good for SEO optimization and minimizes the risk of downgrading.
: WordPress official download
2. No category parents: Author milardovich. the upgraded version of the plug-in above not only removes the prefix of category links, but also removes the parent category parent-category. For example, you can change "/category/parent-category/my-category/" to "/my-category.
: WordPress official download
Advantages: easy to install and suitable for all users. Whether it's a newly built blog, a blog that is planning to use a fixed link/permanent link, or a blog that is well indexed by search engines. You don't need to modify the code, so you don't have to worry about the upgrade. Use 301 to redirect the original link. To prevent downgrading of the search engine and prevent the original link from being opened.
Insufficient: the plug-in may cause a space burden. It is not a disadvantage here, because the "space burden" caused is minimal and should not be a disadvantage. You don't need it if you are concerned about it. we recommend it if you don't care about it.
- Modify the Wordpress function and remove the category prefix category.
1. find the category-template.php under your Wordpress blog wp-uplodes folder.
2. open this file and search for the following code (in the get_category_link () function:
$ Catlink = $ wp_rewrite-> get_category_permastruct (); add the following line to the next line:
$ Catlink = str_replace ('/category', '', $ catlink); the code is used to replace functions with strings, replace/category in the category link of the category link function. To remove the category link prefix/category. 3. save and upload the file to the server.
Advantage: only a piece of code is added, and the performance impact is negligible. Applicable to blogs that are slightly familiar with code.
Disadvantage: modify the code and upgrade the blog. The original address is still accessible. It may lead to repeated titles mentioned in Google's website administrator tool.