I have 2 Custom Post Type(Our Works and Case Study) in a WordPress site. If I add same postname(Pepsi) at my 2 Custom Post Type(Our Works and Case Study) the permalink will show given below:
1) www.example.com/our-works/pepsi/
2) www.example.com/case-study/pepsi-2/
But It should be like:
1) www.example.com/our-works/pepsi/
2) www.example.com/case-study/pepsi/
After searching for hours… I finally figured it out. Posting this for everyone who might encounter the same issue.
I have got 2 solutions:
Install a plugin called Allow Duplicate Slugs By John
Blackbourn
Another one is Add a function to function.php