Allow duplicate permalink slugs for posts in different categories

I have my permalink format set to /%category%/%postname%/ and I have two posts with the same permalink slug, but in different categories.

Ideally, the two permalinks should look like this:

But when I publish the second post, then its slug is changed to post-title-2, which makes the resulting URL

How can I use the same slug for multiple posts that are in different categories? This WordPress Support topic suggests using an outdated plugin that doesn’t work anymore.


The best method is to find another way to structure your URLs that doesn’t break unique slugs. Even though you may not have any plans to do so now, you may need to change the URL structure of the site down the road in such a way that having duplicate slugs would break the site. Furthermore, there may be unforeseen second- and third-order consequences to doing this, such as plugins that won’t work or, worse, will cause fatal errors on the site because of slug collisions. Slugs are kept unique for a reason, and removing this check could wreak havoc going forward.

If your reason for wanting non-unique slugs is to make clean hierarchical URLs for easy sharing in non-linkable areas (print, images, etc.) you may want to consider using something like Quick Post/Page Redirect to allow simple URLs to forward to their full, more complex actual locations using a 301 redirect. It’s not the most elegant or scalable solution, but it’s not going to break compatibility the way non-unique slugs will.

If you just want attractive URLs for the sake of cleanliness in the browser, I’d recommend coming up with an alternative URL structure that can take advantage of unique slugs, such as incorporating the category name into the slug.

Leave a Comment