4 effective ways to remove category text in WordPress URLs

Tutorials 0 lượt xem

[WordPress Tips] Remove the word category in the WordPress URL effectively – By default when you install the WordPress source code, when you create categories (or called categories), the generated link will have the form (domain/ category/category name) with a link on the word “category” considered redundant? It makes your link longer (assuming you create a category “thu-thuat-hay” in “thu-thuat-hay” has a category “thu-thuat-wordpress” so after creating the link the friend obtained is domain/category/thu-thuat-hay/thu-thuat-wordpress) do you feel it’s too long?

In the previous article about WordPress tricks, I showed you how to display Icon Menu in WordPress without using Plugins so you can add Icons to WordPress Menu without using Plugins to ensure professionalism as well as speed. Website loading speed using Font Awesome directly. In this article, I will show you 4 ways to remove the word “category” in WordPress URLs effectively.

Remove category text in WordPress URLs effectively

The presence or absence of the word “category” in the link does not affect SEO much, but if you leave a link too long from a Seoer perspective, the longer the path, the less beneficial it is because Google is afraid of links. trap their “robots”, from a user perspective you will not like it because it is “too long and messy” so how to remove the word “category” in the link. Let’s learn 4 ways to remove the word “category” in WordPress URLs with the blog tips and tricks.

Method 1: Remove from Permalinks

This is the simplest and fastest method, you don’t need to install the Plugin, just change the  Permalinks (static path) to remove the word “category” in the link. First, go to Settings (Settings) > Click on static links (Permalinks) and change as follows

Click on the custom field (Custom Structure) and Copy the following code and paste it after the domain name: /%category%/%postname%/

In the optional section (Optional) in the Category Base section, please type a dot (.) in the blank box.

type-bo-category-wordpress 1

Then save and test the results, but this method you only apply when you first set up the Website.

Method 2: Interfere with the .htaccess file

This is also a pretty simple method, you just need to copy the code below and paste it into the .htaccess file in the folder containing the Website!

RewriteRule ^category/(.+)$ http://www.site.com/ [R=301,L]

Note: Replace “http://www.site.com” with the domain name you are using

Method 3: Remove from Yoast SEO Plugin

Almost all Websites now use Yoast SEO Plugin and are you also using this Plugin? Take advantage of the function of removing the word “category” in the link by going to the Yoast SEO Menu > Click Advanced > Click Permalinks in the ” Change URLs” property , switch to “Remove” in the “Strip the category” property base”

type-bo-category-wordpress-1 1

Save and test the results, but to correct the Url of the Menu bar or the links that we go to link contain the url /category/ (in other words, completely remove the letter “category” in the link) we do the following. Please add the following code before the closing ?> tag of the Functions.php file of the theme you are using (if you do not know the location of this file, you can refer to the article editing themes, WordPress plugins do not need FTP )

/* xóa đường link của category */
function _nice_category_link($link) {
    return str_replace('/category/', '/' , $link);
}
add_filter('category_link', '_nice_category_link');

Method 4: Use the Remove Category URL Plugin

If you feel the above methods are too complicated, just install the Remove Category URL Plugin and activate, you have removed the word “category” in the link (you can refer to the article on how to install the WordPress Plugin to understand). more explicit installation methods) .

So I have guided 4 ways to remove the word “category” in WordPress URLs effectively, choose the method that is right for you? Do you think there is a better method to remove the word “category” in WordPress URLs.

Finally, if you find the article useful, please subscribe to my blog regularly to update the latest articles via Email – Thank you!

Bài viết liên quan