Title: Taxonomy array dropdown
Last modified: August 20, 2016

---

# Taxonomy array dropdown

 *  [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * (@jasonsweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-array-dropdown/)
 * Hi,
 * In my admin I would like to add a meta box with a dropdown list of all the custom
   taxonomies of my portfolio.
 * At this moment I’m using this code for the array:
 *     ```
       $types_array = array();
       $types = get_terms('portfolio-category');
       $types_array[0] = 'Select all';
       foreach($types as $type) {
       	if (is_object($type) ) {
       		$types_array[$type->term_id] = $type->name;
       	}
       }
       ```
   
 * Problem is that the dropdown menu isn’t displaying the categories, only the option“
   Select All”. So it’s empty…
 * To check if there was a bug in my metabox code, I’ve tested it with tags and 
   pages, like this code:
 *     ```
       $options_tags = array();
       $options_tags_obj = get_tags();
       foreach ( $options_tags_obj as $tag ) {
         $options_tags[$tag->term_id] = $tag->name;
       }
       ```
   
 * And this code is working perfect, so there’s a bug in my array. But I’ve been
   trying for hours now… Somebody who can help me out? Thanks!

The topic ‘Taxonomy array dropdown’ is closed to new replies.

## Tags

 * [dropdown](https://wordpress.org/support/topic-tag/dropdown/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 0 replies
 * 1 participant
 * Last reply from: [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-array-dropdown/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
