Support » Fixing WordPress » Custom taxonomy in 3.5 media library

  • I have a hierarchical custom taxonomy defined on the attachment post type. The Media > Library option correctly displays the taxonomy terms in a hierarchical category-like metabox.

    When I open an image for editing in the new Insert Media overlay, the hierarchical custom taxonomy is displayed with a tag-like single entry field and no list of the pre-defined taxonomy terms, instead of with the desired category-like list of terms with checkboxes.

    Is this intentional or a bug? Is there a workaround?
    thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • yeah it seems ‘this part’ is not finished 🙂

    Well you can do that (but it’s baaaad and harcoding) :
    go wp-include/media.php line 1380 insert something like that:

    // make a select if is a taxonomy
    		if ($field['taxonomy'] == 1){
    			$terms = get_terms('YOUR_TAXONOMY', 'orderby=name&hide_empty=0');
    			$item .= "<select class='select-".$term->slug."' id='$id_attr' name='$name' $readonly required>";
    			$selected = 'selected';
    			$item .= '<option value="" '. $selected.'>Choose...</strong></option>';
        		foreach ($terms as $term) {
        			$selected = ($term->slug == $field['value'] ) ? 'selected':'';
        			$item .= '<option value="'. $term->slug .'" '. $selected.'>' . $term->name . '</option>';
    			$item .= "</select>";

    But the cleanest way is to change the text field with jQuery in your theme or plugin – because here you will loose code after an update of WP…


    Thanks for your response. Actually I found a plugin
    that accomplishes this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom taxonomy in 3.5 media library’ is closed to new replies.