We can use get_terms to get subcategories of any given category in WordPress. This will work with WooCommerce and any other custom taxonomy. Here I will create an utility function to show subcategories wherever we need. I will also create a shortcode to show it from post/page editor. Utility Function… Read More »
Tag: is_wp_error
Get parent term of any given term id in WordPress
Getting parent term of any given term id is bit complex, and WordPress doesn’t have any built in method for this. So, I have built a utility function to get top most or immediate parent of any given term id. For example: If you want to get parent category name… Read More »