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

Mike Schinkel mike at newclarity.net
Mon Aug 20 10:53:45 UTC 2012


On Aug 20, 2012, at 3:55 AM, Aero Maxx wrote:
> I did a var_dump on $wp->query_vars outside of the if statement in the function you wrote and this is the result.
> 
> www.domain.com/draw-results/?game=lotto
> Notice: Undefined offset: 3 in ... /public/wordpress/wp-content/themes/twentyeleven-child/functions.php on line 472 - (This is line 472: 'game' => $matches[3])
> array(2) { ["post_type"]=> string(12) "draw-results" ["game"]=> NULL }
> 
> www.domain.com/ball-statistics/?game=lotto
> array(1) { ["attachment"]=> string(5) "lotto" }

Oops, I think it should have been:

'game' => $matches[2],

I tested on a local site but had to change for your site and screwed it up because yours CPTS and my test CPTs are different.  See updated code at:

https://gist.github.com/3390496

Also, why are you testing it with these URLs?

> www.domain.com/draw-results/?game=lotto

> www.domain.com/ball-statistics/?game=lotto


I wrote to work with these, which is what you originally asked for:

> http://www.domain.com/draw-results/game/lotto

> http://www.domain.com/ball-statistics/game/lotto


-Mike




More information about the wp-hackers mailing list