WordPress
How to Remove the Category Base from URLs in WordPress
Want to remove “category” base term from your Wordpress URL. Turning example.com/category/news into example.com/news?. Learn how to remove taxonomy slugs (categories, post tags).
Are you looking for how to remove /category from your URLs in WordPress? I was also searching for how to remove taxonomy slugs (categories, post tags), and finally, I found the solution which will share with you.
How to Remove Category from Post
First, let us learn how to remove taxonomy slugs from a WordPress Post.
Take the below Post URL as an example:
https://example.com/category/sample-post
You can see /category/ is present in the URL.
So that I need to make URL as
https://example.com/sample-post
To change Remove Category slug from Post URL
- Go to Settings> Permalinks
- Select Post Name [https://example.com/sample-post/]
- or Select Custom Structure and Add /%postname%/ after the root domain name.
- Save Changes
To change or Remove Categories Prefix
Method: Using Yoast SEO Plugin
Category URLs in WordPress contain a prefix, usually /category/, using Yoast SEO plugin you can remove that prefix, for categories only.
- Login to your WordPress website Dashboard
- Click on ‘SEO’ >Search Appearance
- Click on the ‘Taxonomies’ tab.
- Toggle the ‘Category URLs’ switch.
- To Include Category prefix, Switch to ‘Keep’.
- To Exclude, Switch to ‘Remove’.
- Save Changes
Conclusion
There are many other methods to remove category base from URLs in WordPress, it may be using htaccess or using some other third-party plugin. Let me know your thoughts via comments.