Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active October 30, 2018 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffordp/94033d6d1558a84fa9a3214e1f850cda to your computer and use it in GitHub Desktop.
Save cliffordp/94033d6d1558a84fa9a3214e1f850cda to your computer and use it in GitHub Desktop.
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment