Title: About Categories
Last modified: August 22, 2016

---

# About Categories

 *  [Dannie Herdyawan](https://wordpress.org/support/users/k0z3y/)
 * (@k0z3y)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/about-categories/)
 * Hi all, how to create this with php?
 * – Categories
    — Child Categories — Child Categories 1 — Child Categories 2
 * – Categories 2
    — Child Categories — Child Categories 1 — Child Categories 2
 * Thanks…

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Dannie Herdyawan](https://wordpress.org/support/users/k0z3y/)
 * (@k0z3y)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/about-categories/#post-5285611)
 *     ```
       function publish_categories($args){
       		$taxonomies=get_taxonomies( array('public' => true) , 'names');
       		if (isset($args['allowed_taxonomies'])){
       			$allowed = explode(',',$args['allowed_taxonomies']);
       		} else {
       			$allowed = array('category','post_tag');
       		}
       		$taxonomies = array_intersect( $taxonomies, $allowed );
       		foreach ($taxonomies as $taxonomy ) {
       			$the_tax = get_taxonomy( $taxonomy );
       			$terms = get_terms( $taxonomy , array('hide_empty' => 0));
       			if ($terms) {
       				$array["optgroup_b_{$taxonomy}"] = $the_tax->labels->name;
       				foreach($terms as $term) {
       						$array["" . $term->slug . "#" . $taxonomy . ""] = $term->name;
       				}
       				$array["optgroup_e_{$taxonomy}"] = $the_tax->labels->name;
       			}
       		}
       		return $array;
       	}
       ```
   
 *     ```
       /* set categories */
       				case 'post_categories':
       					$options = publish_categories($args);
       					$res .= "<select name='".$key.'-'.$i.'[]'."' multiple='multiple' class='chosen-select' data-custom-error='".__('Please choose a category at least','userpro')."' data-required='".$args['require_category']."' data-placeholder='".$placeholder."'>";
       					foreach($options as $k=>$v) {
       						if (strstr($k, 'optgroup_b')) {
       							$res .= "<optgroup label='$v'>";
       						} elseif (strstr($k, 'optgroup_e')) {
       							$res .= "</optgroup>";
       						} else {
       							$res .= "<option value='$k'>$v</option>";
       						}
       					}
       					$res .= "</select>";
       					break;
       ```
   
 *  [sffandom](https://wordpress.org/support/users/sffandom/)
 * (@sffandom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/about-categories/#post-5285617)
 * WordPress by default allows you to assign categories to other categories as children.
   Just go to the POSTS/CATEGORIES dashboard.
 *  Thread Starter [Dannie Herdyawan](https://wordpress.org/support/users/k0z3y/)
 * (@k0z3y)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/about-categories/#post-5285626)
 * I want create frontend publisher, so member can post on frontend. And i want 
   show all categories with dropdown like this:
 * – Categories
    — Child Categories — Child Categories 1 — Child Categories 2
 * – Categories 2
    — Child Categories — Child Categories 1 — Child Categories 2

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘About Categories’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Dannie Herdyawan](https://wordpress.org/support/users/k0z3y/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/about-categories/#post-5285626)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
