Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#45051 closed defect (bug) (duplicate)

Term Count misleading when on Post Type focused listing

Reported by: garrett-eclipse Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: ui, administration Cc:



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;

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.


Attachments (2)

Screen Shot 2018-10-04 at 3.56.51 PM.png (93.4 KB) - added by garrett-eclipse 2 years ago.
Custom Taxonomy (Key Facts) with Term (Sitemap) showing a count of 2 as there's a page and media item associated to the term.
Screen Shot 2018-10-04 at 3.57.27 PM.png (86.8 KB) - added by garrett-eclipse 2 years ago.
Clickthrough the count you get a list filtered to pages so only one item showing but the count had 2

Download all attachments as: .zip

Change History (6)

2 years ago

Custom Taxonomy (Key Facts) with Term (Sitemap) showing a count of 2 as there's a page and media item associated to the term.

2 years ago

Clickthrough the count you get a list filtered to pages so only one item showing but the count had 2

#1 @desrosj
2 years ago

  • Version 4.9.8 deleted

Thanks for all of the great thoughts on this, @garrett-eclipse. #38280 is a preexisting ticket that discusses this. There’s a lot of iterations and a working patch there. Closing in favor of that ticket.

#2 @garrett-eclipse
2 years ago

Thanks @desrosj I ran through #38280 but don't see any update related to the list table count with that be address within by replacing the column count code with the newly proposed wp_get_term_object_count?

If so that's awesome as it would address the misleading count. But I wonder if there'll be a way to get a general/global list with complete count that links to a list table of all mixed post type items? Or is that addition beyond what's proposed there?


#3 @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #32942.

#4 @garrett-eclipse
2 years ago

Thanks @SergeyBiryukov overlooked that one.

Note: See TracTickets for help on using tickets.