[wp-trac] [WordPress Trac] #23530: Attachment taxonomies, $term->count not working

WordPress Trac noreply at wordpress.org
Tue Feb 19 15:08:20 UTC 2013


#23530: Attachment taxonomies, $term->count not working
-----------------------------+--------------------------
 Reporter:  paddelboot       |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:                   |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 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', $args3 );

 //$non_empty_directories is an empty array(), but it should return the ID
 of //the 'parent' term.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23530>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list