[wp-hackers] Best practice for archives of custom post types

Otto otto at ottodestruct.com
Fri Feb 5 21:14:10 UTC 2010


On Fri, Feb 5, 2010 at 1:26 PM, Michael Pretty <mpretty at voceconnect.com> wrote:
> You need to somehow pass in the 'post_type' query_var through the URL.  You
> can do this by either directly adding post_type=my_post_type to the query
> string of url ...

No, post_type isn't one of the public_query_vars, so you can't add it
to a URL without special code to allow it. You basically do this by
adding a filter to the 'query_vars'.

On the other hand, if you simply use register_post_type() to register
your new type, then this sort of thing gets all taken care of for you.
query vars, rewrites, permastructs, everything.

-Otto
Sent from Memphis, TN, United States


More information about the wp-hackers mailing list