How to display all CATEGORIES and SUB-CATEGORIES in wordpress if a category having 0 posts also. I tried but it is displaying categories which are having at least 1 post in a category . I want to display categories which are having 0 posts also.
Thank You
See the get_categories function, there is a parameter called “hide_empty”. For instance:
use get_categories() function to get all categories.
after you have stored all categories in a variable use print_r to see all the values of the array that you can use.
when you use print_r you will see like this
play with the code and you will get what you want.