[wp-hackers] 1 taxonomy on 2 different custom post types

Mike Schinkel mike at newclarity.net
Tue Aug 21 07:37:46 UTC 2012


On Aug 21, 2012, at 3:30 AM, Aero Maxx <aero.maxx.d at gmail.com> wrote:
> Oopps sorry I was in a rush to leave for work and I have copy and pasted the urls off the wrong post, meant to do the ones that you mentioned.
> 
> The problem I had before has gone, but I think there is a problem still but not with the code you wrote I believe this would work, I think its to do with my register_taxonomy, have pasted it here http://pastebin.com/YieR47eQ.
> 
> On the draw results page everything works just as it should on the ball statistics page it doesn't.
> 
> I can only think that its down the rewrite part in the $args for the register taxonomy, as I would like the urls to be http://www.domain.com/ball-statistics/lotto and http://www.domain.com/draw-results/lotto.
> 
> Draw Results works perfectly and am sure the Ball Statistics will also once have fixed the rewrite part as I think that's the issue.
> 
> ball-statistics cpt I get :-
> array(1) { ["attachment"]=> string(5) "lotto" }
> 
> draw-results cpt I get :-
> array(2) { ["post_type"]=> string(12) "draw-results" ["game"]=> string(5) "lotto" }

You are over-thinking it.  Set the slug to just 'game' and the code I gave you should work.

-Mike  

P.S. BTW, there are numerous ways to route URLs in WordPress. This is just one way.




More information about the wp-hackers mailing list