[wp-trac] [WordPress Trac] #45051: Term Count misleading when on Post Type focused listing

WordPress Trac noreply at wordpress.org
Thu Oct 4 23:00:07 UTC 2018


#45051: Term Count misleading when on Post Type focused listing
--------------------------------+-----------------------------
 Reporter:  garrett-eclipse     |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Taxonomy            |    Version:  4.9.8
 Severity:  normal              |   Keywords:
  Focuses:  ui, administration  |
--------------------------------+-----------------------------
 Hello,

 When you associate a taxonomy to multiple Post Types then under each of
 those post types is a page for that custom taxonomy which lists the terms
 with a count that's clickable. The count currently uses the WP_Term $count
 which accounts for all content across post types. Clicking this number
 takes you to a list view filtered to the taxonomy and post type which is a
 subset of the taxonomy term count and as such doesn't match up with the
 count previously seen.

 Thinking on this for some time there's a few options;

 1. The count can be switched from using the WP_Term $count to a query that
 takes into account the current post type view. This way the count will
 match with the click-through list table.
 2. The count can be left as the full term count and instead update the
 link to click-through to a list table which lists ALL associated content
 from all post types. This requires a new list table that would accept a
 new param of post_types that could be 'any' or an array as the existing
 Term list table requires the post_type and if not set defaults to post.
 3. The full count can be provided followed by a sub-count filtered for the
 currently viewed post type so would present like 'X (Y posts)' where X is
 the full count and Y is the count specific to the post type and posts
 would be the currently viewed post types. In this way when you click
 through Y you get the view filtered to the current post type, and if you
 click X you get a new list table listing all post types similar to what is
 proposed in #2.

 Obviously #1 would be the easiest solution but #2/3 would provide more
 useful views and experience.

 And to give more understanding where the count comes from is found in
 column_posts;
 https://github.com/WordPress/WordPress/blob/56c162fbc9867f923862f64f1b4570d885f1ff03
 /wp-admin/includes/class-wp-terms-list-table.php#L538

 If the approach to introduce a general list table for 'any' post type
 occurs then there's also potential to provide the taxonomy edit-tags.php
 page without a post type focus in a more general location.

 Thank you for the consideration, at the very least would love the
 misleading count number corrected.

 To Reproduce;
 1. Create a custom Taxonomy and associated with both Posts and Pages.
 2. Create a page and associate a new term for the taxonomy.
 3. Create a post and associate with the same term from #2.
 4. Navigate to Posts > Taxonomy and note the count of 2 beside the term
 you created.
 5. Click the count number and note you see only one item lists as you're
 in a view filtered to the post type.

 Cheers

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


More information about the wp-trac mailing list