WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a list of categories that go with my 'posts' I want the same categories to go with my custom post types 'services' and 'work'

The following code, adds the tags and categories to the work and services custom posts.

add_action('init', 'demo_add_default_boxes');

function demo_add_default_boxes() {
    register_taxonomy_for_object_type('category', 'work');
    register_taxonomy_for_object_type('post_tag', 'work');
    register_taxonomy_for_object_type('category', 'services');
    register_taxonomy_for_object_type('post_tag', 'services');

But when I categorise a work/service post, it does not appear on the /category/ page, only the 'posts' from that category appear.

share|improve this question
up vote 4 down vote accepted

By default, only post_type post is shown on category pages. To enable your custom post types, you could hook pre_get_posts, check if it's a category page, and if so add your post types:

function wpse_category_set_post_types( $query ){
    if( $query->is_category() && $query->is_main_query() ){
        $query->set( 'post_type', array( 'post', 'work', 'services' ) );
add_action( 'pre_get_posts', 'wpse_category_set_post_types' );
share|improve this answer
you sir are a scholar and a gentleman, works perfectly – Adam Mar 28 '12 at 3:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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