[wp-hackers] Best practice for archives of custom post types
Michael Pretty
mpretty at voceconnect.com
Fri Feb 5 21:31:27 UTC 2010
> 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.
>
>
As of http://core.trac.wordpress.org/changeset/12923, post_type is a
public query_var by default, though it filters to only allow registered
post_types that are publicly queryable. I'm not positive, but I'm
pretty sure that register_post_type only sets up a rewrite rule for
/%post_type%/%post_name%/ and doesn't set one up that would allow an
archive listing of the post_type. So you would need to set this up
yourself.
Michael Pretty
@prettyboymp
More information about the wp-hackers
mailing list