The Events Calendar (TEC) and WooCommerce: Add TEC's taxonomy to Products post type.
<?php
/**
* The Events Calendar (TEC) and WooCommerce: Add TEC's taxonomy to Products post type.
*
* @link https://gist.github.com/cliffordp/94033d6d1558a84fa9a3214e1f850cda This snippet.
*/
function cliff_add_tec_cat_to_woo_products( $taxonomy, $object_type ) {
if (
! class_exists( 'Tribe__Events__Main' )
|| Tribe__Events__Main::TAXONOMY !== $taxonomy
|| Tribe__Events__Main::POSTTYPE !== $object_type
) {
return;
}
register_taxonomy_for_object_type( $taxonomy, 'product' );
}
add_action( 'registered_taxonomy', 'cliff_add_tec_cat_to_woo_products', 10, 2 );