Adding Categories to Custom Post Type in WordPress
I recently ran into the the need to extend post categories to a post type that I didn’t create. This can be especially useful when you’re calling two post types in one loop, and also want to specify a category.
In this example, we’re add Post Categories to the ‘tribe_events’ post type created by Modern Tribe’s The Events Calendar.
Naturally, this goes in your functions.php file 🙂
function extend_taxonomy() {
register_taxonomy_for_object_type( 'category', 'tribe_events' );
}
add_action( 'init', 'extend_taxonomy');