I’m running a query on a custom plugin to display all categories and put them into a dropdown (the select parts are outside the loop) which looks like this:
<?php
$ember_categories = get_categories();
foreach($ember_categories as $ember_category) {
echo '<option value="' . $ember_category->cat_ID . '">' . $ember_category->name . '</option>';
}
?>
For some reason though, it’s only returning my default category (Uncategorized) – even though there are six more added to the system (including one I added afterwards, just as a curiosity). I’m wondering whether I’m doing something glaringly wrong?
Try
get_categories( array('hide_empty' => 0 ) );