0

I have a custom post type called 'requests' that has a custom taxonomy 'request-categories'. I've created a template with a modified loop that allows me to view my custom post type in a certain 'request-category' for instance 'electronics-requests'.

The loop works if I manually change the args for post type and taxonomy but, in order for it to be usable, I need to figure out how to deal with the urls so that mysite.com/requests/request-category/electronics-request will modify the loop in such a way that will provide the expected results.

The way I see it, mysite.com/requests will be an actual page, while the request-category and electronics-request portions of the url would be assigned to the appropriate variables in the loop. WHich seems easy enough but I don't know how to keep wordpress from 404ing.

I'm trying to do exactly what wordpress already does with posts and categories. I'm very close to having this working but I'm running in to a wall here. It seems to me that this should be a standard feature and this is critical to full functionality of custom post types.

2 Answers 2

0

Add one of your custom taxonomies to a wordpress menu, then click the menu item in frontend and you'll see the correct url in the address bar. If this doesn't fit your needs have a look at the "rewrite" part of the register_taxonomy() arguments.

1
  • Ok, that's a start.. the urls seem to be working as I would want them to when I add them to a menu: mysite.com/request-category/communication-equipment-requests/ but they just 404.
    – ItsGeorge
    Jul 17, 2013 at 20:44
0

Edit: Figured it out!

Okay, so it turns out that what I'm trying to do actually is available in Wordpress but it requires a very odd and unintuitive trick to get it to work. A while back, when I was working on a multisite installation and we couldn't get pretty permalinks to work. One day, I stumbled across this blog post. Ultimately what it said was that after you have modified your permalink structure in the multisite settings, you need to click on permalinks in the menu... that's it, you don't do anything or change an settings, you just go to that page. Something happens when you go to the permalinks page in the admin menu that seems to fix a lot of issues with permalinks and when it popped in to my head a few minutes ago I decided to try it. IT WORKED. It's the weirdest fix I think I've ever found but this will probably be the fourth time that it's solved permalink issues for me. I've spent 2 days trying to figure this out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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