function insert_dynaic_taxonomy_terms() { global $post; // Exit if post doesn't exist or it has been moved to trash if (NULL === $post || 'trash' === get_post_status($post->ID)) { return; } switch ($post->post_type) { case 'paquetes': insert_dynamic_taxonomy_term($post->post_title, 'paquetes'); break; default: # code... break; } }
function insert_product_categories($taxonomy) { if ('product_cat' == $taxonomy) { $product_cat = array('Kids', 'Women', 'Men'); foreach ($product_cat as $cat) { insert_dynamic_taxonomy_term($cat, $taxonomy); } } }