Trying to loop through post categories? All you may need is to use the get_categories() function to loop through them with a PHP foreach loop.
2 answers
1
Looping through WordPress post categories
To loop through WordPress post categories, copy and paste the code below into the file you wish to display them on.
<?php foreach ( get_categories() as $category ) : echo $category->name; endforeach; ?>
— Support WizardAnswer 1
0
get_categories() not working?
As per this guide, you need to pass hide_empty into get_categories() in order to display all unused categories too.
— Support WizardAnswer 2