• Hello. I am trying to make a check box with categories for users adding content from the front end.

    <?php
    					$categories = get_categories(array('orderby'=>'name','parent'=>3,'hide_empty'=>0));
    						foreach($categories as $categories){
    							?>
                                	<input name="categories" type="checkbox" value="<?php echo $categories->cat_ID; ?>" /><?php echo $categories->name; ?><br />
                                <?php
    						}
    				?>

    I am currently using this to create the checkbox.

    It works fine, except for the fact that the checkboxes are only displaying for categories that have existing posts.

    I am using the hide_empty to display the empty categories, but it does not seem to be working.

    Am I missing something within in the provided code?

    thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter awwnuts

    (@awwnuts)

    <?php
    $categories = get_categories(array('orderby'=>'name','parent'=>3,'hide_empty'=>0));
    foreach($categories as $categories){
    ?>
    <input name="categories" type="checkbox" value="<?php echo $categories->cat_ID; ?>" /><?php echo $categories->name; ?><br />
    <?php } ?>

    Sorry, the first one displayed sort of sloppy.

    Thread Starter awwnuts

    (@awwnuts)

    any help?

    Thread Starter awwnuts

    (@awwnuts)

    Has anyone experienced this problem? I have tried google, but am not yielding any results of value.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_categories – hide_empty=0 not displaying categories that are empty’ is closed to new replies.