Remove Wordpress category base prefix without plugins

Gabriel Guerra
2 min readNov 21, 2020

Love it or hate it, if you’re a web developer, chances are big that sooner or later you’ll have to handle a Wordpress project. Probably you already have had to.

Photo by Alain Pham on Unsplash

One of the features WP has out of the box is the ability to organize your posts in categories. But sometimes you need to impose your own kind of content hierarchy.

How to remove Wordpress category base prefix without plugins?

Let’s imagine you need an url structure like “news/category-name/” to show posts by given category. Using the out of the box feature will do the job perfectly.

Now let’s supose you have to deal with a multi language website. How would you solve it? Easy! Create a page for each top category which in this case would be “News” for the english version. That page would carry all the logic to display your posts.

Ok, Gabriel, but what about the categories? It’s a little bit tricky, but still easy to accomplish.

Step by step

Create a category with the same name of the page — News.

Go to permalinks section in control panel.
In “custom structure” choose /%category%/%postname%/

Now the trick! In the optional field bellow, in “base category” just type a dot “.”. Yes, a single dot.

Now the category base is gone and you can use your own SEO friendly url structure.

It’s a feature? It’s a bug? Leave your comments!

Happy coding! :)

--

--