WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

$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?

share|improve this question
Doh! Should probably have thought of that. Thanks! – George Pearce Jul 28 '11 at 22:45
Hey. Just saw that you removed the check mark for the solution. Could you please leave a comment on the answer, so it can be improved for later readers? – kaiser Dec 27 '11 at 18:23
Apologies - didn't mean to remove the check, I clicked it so it would accept your answer. Returned now, appreciate your help. – George Pearce Dec 27 '11 at 20:52
up vote 7 down vote accepted

Try get_categories( array('hide_empty' => 0 ) );

share|improve this answer
Thanks Kaiser. great help. – arslaan ejaz Jul 17 '13 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.