Use category base slug in posts’ permalink


The Goal

I would like to format my permalinks as follows:

  • for posts: somePrefix/%category%/%postname%
  • for categories: somePrefix/%category%

Where somePrefix is the same in both cases.

I know that there is no big upside to this – it just seems “clean” to me 🙂 . And it comes in handy if you want to manually edit the URL.

What I Tried

No Category Base

One approach is to define the posts’ permalinks as /%category%/%postname%/ and use a plugin to get rid of the category base. Unfortunately those plugins seem to be buggy and are discouraged to use (e.g. by Yoast SEO Plugin).

Same Category Base

No problem, I thought, let’s just use the category base in the permalinks as so: category_base/%category%/%postname%. This produces:

  • for posts:
  • for categories:

This works for the categories but now links to posts produce 404s.

Now What?

So is there a way to achieve this? A setting, a plugin or perhaps even hacking WordPress a little to properly process the links which created by Same Category Base?

, , , Nicolai 9 years 2014-06-09T08:19:40-05:00 0 Answers 119 views 0

Leave an answer