﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
23530,"Attachment taxonomies, $term->count not working",paddelboot,,"Backend:

1. Register an attachment taxonomy
2. Create a taxonomy term
3. Upload an attachment and check the box of the newly created term, save.
4. Go to the attachment taxonomie's overview
5. Under ""Media"", it shows 0
6. Click on ""0"", and you should see the attachment in the overview.

Code:
{{{
register_taxonomy( 'attachment_directories', 'attachment' );

$term = wp_insert_term( 'parent', 'attachment_directories' );

$args = array(
			'post_title' => 'dummy-attachment',
			'post_content' => '',
			'post_status' => 'inherit',
			'post_mime_type' => 'image/jpeg',
			'post_author' => '1'
		);

$id = wp_insert_attachment( $args );

wp_set_object_terms( $id, $term[ 'term_id' ], 'attachment_directories' );

$args = array(
			'hide_empty' => TRUE,
			'fields' => 'ids'
		);

$non_empty_directories = get_terms( 'attachment_directories', $args );

//$non_empty_directories is an empty array(), but it should return the ID of the 'parent' term.
}}}",defect (bug),closed,normal,,Taxonomy,,normal,duplicate,,ms@…
