[wp-hackers] 1 taxonomy on 2 different custom post types
Mike Schinkel
mike at newclarity.net
Sun Aug 19 00:20:45 UTC 2012
On Aug 18, 2012, at 2:25 PM, Aero Maxx wrote:
> Is it at all possible to have 1 custom taxonomy on 2 different custom post types, and have them filtered.
>
> I have 2 different custom post types that both use the same taxonomy, and I would like to do url filtering.
>
> One is called "Draw Results" and the other "Ball Statistics", I would like the below urls so show only posts in the custom post type in the url that are in the taxonomy "Game".
>
> http://www.domain.com/draw-results/game/lotto
> http://www.domain.com/ball-statistics/game/lotto
>
> This was working when was only 1 custom post type, but since I have added a 2nd the above links dont filter, they show all posts in the taxonomy regardless of which custom post type they are in.
Your might be able to use add_rewrite_rule() although it may conflict with other URLs, not sure. I rarely use the "official" approach because it requires rewrite rules to be refreshed.
What I like to use is the 'parse_request' hook at modify $wp->query_args. You can find an example that should meeting your needs here and it can give you a little insight into what URLs translate to internally:
https://gist.github.com/3390496
-Mike
More information about the wp-hackers
mailing list