0

I created two different custom post types in wordpress. But I need same slug for both custom post types. But Only one custom post type is working and another post types is showing as 404 not found. Can anyone help me how can I implement this?

  • You can't have two post types with the same slug. Why do you need this? There's likely a better solution. – Jacob Peattie Dec 11 '19 at 9:18
  • @JacobPeattie Thank you. But I have a requirement like this from my client. I already research many sites about this but I can't find any related one. Is there any way I can achieve this like replacing the slug only in frontend for one post type. – shahul Dec 11 '19 at 9:40
  • I doubt the requirement was literally “I need two post types with the same slug”. What is the actual requirement? The ultimate goal? Why do you need two post types? Please explain the actual problem you’re trying to solve, from the beginning. – Jacob Peattie Dec 11 '19 at 10:47
  • @JacobPeattie. I already have one custom post type(CPT1) with slug (/services). I am using paid marketing tool for those posts which have slug (/services). Recently I created new custom post type(CPT2) having different template with slug (/events). I also want to market those posts with slug (/events). If I use new slug (/events) I have to pay addition money for using another slug (/events) posts. I don't want to pay additional money for that, so I have plan to use same slug for CPT2 also i.e.(/services). I hope you got my requirement – shahul Dec 11 '19 at 11:26
0

A slug is a URL. Ask yourself this question:

If I were to send you the following two links:

http://yoursite.com/services

http://yoursite.com/services

Those are two posts just like you want them.

Then how will the browser know to direct your to one post or the other if the URL is identical?

In other words, you can't have two slugs that are the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.