[wp-trac] [WordPress Trac] #48454: Term count incorrect for custom taxonomy on attachments

WordPress Trac noreply at wordpress.org
Tue Oct 29 03:02:56 UTC 2019


#48454: Term count incorrect for custom taxonomy on attachments
--------------------------+-----------------------------
 Reporter:  powerbuoy     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.2.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When creating a custom taxonomy for the 'attachment' post-type its term
 counts aren't properly updated.

 To reproduce:

 1) Download and install WordPress 5.2.4 with the twentynineteen theme

 [[Image()]]

 2) Add a custom taxonomy:

 {{{#!php
 <?php
 add_action('init', function () {
         register_taxonomy('attachment_category', 'attachment', [
                 'labels' => [
                         'name' => 'Attachment categories',
                         'singular_name' => 'Attachment category'
                 ],
                 'rewrite' => [
                         'with_front' => false,
                         'slug' => 'attachment-categories',
                         'hierarchical' => true
                 ],
                 'hierarchical' => true,
                 'sort' => true,
                 'show_in_rest' => true,
                 'show_admin_column' => true
         ]);
 });
 }}}

 [[Image()]]

 3) Create some taxonomies and assign them to media:

 [[Image()]]

 4) Notice how term count still says zero:

 [[Image()]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48454>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list