'how to use same slug for different post within same post type but have different category name in the permalink in wordpress

I want to use single category in the permalink and want to have multiple post having same slug.

Ex.

  1. mysite.com/category-1/my-post
  2. mysite.com/category-2/my-post
  3. mysite.com/category-3/my-post

I know that wordpress does't allow multiple post with same slug but if there is any way to work around.

I have tried by making custom post type and adding it in the slug like mysite.com/post-type-1/my-post but still wordpress add -2 in the slug.

is there any other way or only way for making this happen ?



Solution 1:[1]

yes, you can add the custom slug of your post easily from your side bar of post page in WordPress dashboard permalink >>add your custom slug like this

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Syed Israr Ahmad