[wp-hackers] Custom taxonomy archive page

Lox lox.dev at knc.nc
Tue Apr 30 08:08:29 UTC 2013


Hello,

I have registred a custom taxonomy for a custom post_type. The taxonomy UI
shows properly for that custom post_type in wp-admin and I can assign posts
to it.

When I try to access a taxonomy's archive page (using the display link in
the taxonomy UI in wp-admin), it is always a 404 page.

I looked a bit and here is the query generated:

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN
wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (13) ) AND
wp_posts.post_type IN ('post', 'page', 'attachment') AND
(wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND
wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY
wp_posts.post_date DESC LIMIT 0, 10

So the part giving me trouble seems to be:

AND wp_posts.post_type IN ('post', 'page', 'attachment')

Why does WP restrict to those post_type whereas my taxonomy is allocated
only to my custom post type?

Should I hack the query using filters?

Regards.

-- 
Lox
lox.dev at knc.nc


More information about the wp-hackers mailing list