URL rewriting hack for custom post types
I’m pretty much new to the new and awesome feature wordpress released for us it’s latest version: custom post types.
I managed to set them up in the admin, publish some and display them on my blog.
The problem is that even after many hours of playing around and searching online, I can’t find a way to rewrite my URLs in a way that makes sense.
I have about 4 different custom post types and they all share the same categories and sub-categories. I would like the URLs to look like this:
View all posts by post category and type: http://myblog.com/category/category/post_type/
View a specific post:
I have tried to play with the $wp_rewrite array, the create_rewrite_rules hook, the custom_permalink hook, etc. but I can’t make anything actually work the way I want.
I have actually been able to figure a work around to get this structure: http://myblog.com/post_type/category/category/
But then the posts don’t work when I go to: http://myblog.com/post_type/category/category/post_id-postname/
Here is the latest code I have been playing with.
- The topic ‘URL rewriting hack for custom post types’ is closed to new replies.