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

Michael Pretty mpretty at voceconnect.com
Fri Feb 5 19:26:38 UTC 2010

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 for a normal archive page, or adding a rewrite rule 
that turns example.com/my-post-type/ to example.com/?post_type=my_post_type.

If you want some examples of more complex handling for the archive 
pages, I just finished the beta version of a plugin today that 
automatically adds rewrite rules for custom post_types:  
Check out the add_rewrite_rules() method in 

Michael Pretty

On 2/5/10 1:44 PM, Alex Dunae wrote:
> I'm really enjoying the custom post types in WP 3.0, but I can seem to
> find a sensible way to display an archive-style (or index) page for a
> specific post_type.  Is there a best practice for this without hacking
> around with the query?
> Alex
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list