Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function get_root_category($category_id='')
- {
- $mycat = get_term($category_id, 'product_cat');
- $myparent = $mycat->parent;
- if ($myparent > 0) return get_root_category($myparent);
- else return $mycat->term_id;
- }
- ?>
Add Comment
Please, Sign In to add comment