Is there a way to use regular categories with custom post types? It seems like there is better functionality and options with regular categories (such as permalink options, etc.).


No problem, the categories and tags are also registered as taxonomies that you can pass to the taxonomies argument when you call register_post_type(). Categories are category and tags are post_tag. You can also do this later with register_taxonomy_for_object_type():

add_action( 'init', 'wpse6098_init', 100 ); // 100 so the post type has been registered
function wpse6098_init()
    register_taxonomy_for_object_type( 'category', 'your_custom_post_type' );
  • Is there an easy way to get the custom post type posts to show up in filtering results, too? – Rasmus Sep 5 '12 at 22:19
  • @Rasmus: Do you mean on the category pages? Like /category/banana/, do you want to see regular posts and your custom post types mixed together? I think you need to hook into the query parameters and add your custom post type to the post_type parameter. But it has been a while since I used WordPress, it's not in my active memory now :-) – Jan Fabry Sep 6 '12 at 7:12
  • Yep, that's exactly what I wanted. My reason is that otherwise it might be a little hard finding those posts. If someone has the answer in active memory, it would be appreciated -- until then, I'll make do with my (not pretty) work-around! – Rasmus Sep 7 '12 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.