1

The wordpress theme I'm using uses a custom post type called 'coupon' and a custom taxonomy called 'store'. The default permalink structure for a coupon post is

site.com/coupon/CouponPost

I would like to change the permalink structure to:

site.com/%stores%/CouponPost

I used a plugin called 'Custom Post Type Permalinks' to add the store taxonomy to the permalink structure so it displays as:

site.com/coupon/%stores%/CouponPost

I now need to try and remove the custom post type slug 'coupon' from the permalink structure.

I found some code of GitHub that removes the CPT slug but causes 404 errors when the 'Custom Post Type Permalinks' plugin is added. When the plugin is deactivated the CPT slug is removed and everything works perfectly. The issue is getting the two to work together. I believe that removing the plugin and adding a custom rewrite rule to the CPT may do the trick but it's way past may level of understanding so hoping some of the experts in here might know a solution!

  • Welcome to WPSE! If you're worried about understanding of rewrite rules, feel free to ask other questions about specifics such as what query vars are, how to add a rewrite rule, and how rewrite tags such as %stores% are defined – Tom J Nowell Dec 18 '14 at 2:34
  • Hi Tom, thanks for getting back to me. I'm completely out of my depth here as I don't even know PHP so was hoping someone might be able to provide a solution. Happy to post any additional code here though. I have come across multiple people with a similar problem while looking for a solution and I'm sure they could also benefit. – Fergal Dec 18 '14 at 3:06
  • My only worry then is that if an answer came, because you don't know PHP, you wouldn't have the knowledge needed to understand it, but I'm sure people have asked similar questions here before, some digging in search might find the answer on this site on a very similar question – Tom J Nowell Dec 18 '14 at 3:14
  • 1
    This solution looked promising, but as you said, I don't know how to adapt the solutions to my situation. – Fergal Dec 18 '14 at 3:47
  • It is a little dense, but that would cover just a taxonomy, I don't think it covers what you're trying to do =( – Tom J Nowell Dec 18 '14 at 12:14

Your Answer

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

Browse other questions tagged or ask your own question.