Last active
October 30, 2018 04:43
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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