How to get Custom Posts All Categories and All Subcategories in WordPress Programmatically

1
157

The following code will get the Custom Post All Categories and All Subcategories. Please note that you have to add this code to where you want categories and subcategory list.

Here you can apply this code to any Custom Post as well as Woocommerce Products get All categories and All Subcategories.

Here $taxonomy = ‘CUSTOM_POST_TYPEt’; you can add POST TYPE which you want to fetch categories and subcategories.

The following code will get the woocommerce products All Categories and All Subcategories. Please note that you have to add this code to where you want categories and subcategory list.

If you need help with the code or would like to add to the discussion, do leave a comment below.

Facebook Comments

To get more updates from Snazzypost, LIKE our Facebook page

689FansLike