How to strip category base from URL in WordPress
How to strip category base from URL in WordPress

Date

WordPress automatically includes the term name (category or tag) between the domain and the category slug. This is the easiest way to strip category base from URL in WordPress and come up with a much smaller URL.
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on skype
Share on whatsapp

When selecting the “Custom Structure” option in the Permalinks, one of the most common tags selection is this: /%category%/%postname%/. This is, perhaps, the best practice for websites that need a higher ranking in the search engines and more consistent URLs for marketing reasons.

Taking SEO into account, the standard WordPress practice to include the term type (prefix) in the term’s URL is rather annoying. A much cleaner URL is always more welcome and easier to remember. Removing the term type (category base) from the URL is easy to do, without needing to alter the .htaccess file or messing around with the functions.php file. These two files should be handled only by those who know exactly what they are doing and ALWAYS after taking a backup of the specific file (just in case…).

For everybody else, simply go to Settings > Permalinks and scroll down to Options. There, you can change the category base and the tag base slugs to whatever you want.

For example, you can choose “blog” as a category base, in which case all category URLs will carry /blog/ before their slug: /blog/category-slug/. The same goes for the tag base.

How to strip category base from URL in WordPress

What if you want to remove the category or tag base from the URL?

Things couldn’t be easier. All you need to do is place a dot in the relevant input. Check our photo to see how we removed the category base from the URL, leaving the tag base intact.

This is the simplest and fastest way to achieve a proper hierarchy between categories and tags and at the same time insert the most important services of your company to the categories, leaving less important ones for the tags.

Term permalinks in WordPress

Why not use a plugin instead?

Adding extra plugins for performing tasks that can be completed otherwise, is not a wise option. Plugins must be used only when absolutely necessary. However, if you are already using Yoast SEO or Rank Math SEO plugins, please note that they both offer such an option, without the need to change the permalink structure, as previously suggested.

MORE FROM OUR