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.
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: