WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18072 closed defect (bug) (duplicate)

Custom post type count for custom taxonomy incorrect because it includes revisions

Reported by: danielbachhuber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

In the column that shows the number of posts of a given custom post type associated with a given custom taxonomy term, the count includes post revisions. This is erroneous and different than the behavior WordPress exhibits for standard taxonomies with standard posts.

Instead, WordPress should count all posts of a given custom post type minus the number of revisions for each post (e.g. each post should only be counted once)

Change History (5)

comment:1 nacin3 years ago

I'm not sure if it's actually revisions that it's counting, rather, it's the number of posts of any type. In which case this would be a duplicate of a few other tickets and is due to deficiencies in the existing taxonomy structure, with a single term only having one term_count field, rather than a term_count field for each post type it is attached to.

comment:2 danielbachhuber3 years ago

I'm looking further into the code to see if I can diagnose. Every time I save a revision, the count increments. I still suspect that it's a query problem.

comment:3 danielbachhuber3 years ago

Ok, you win. It's using the 'count' value from the database. What's the best way to close this ticket, and which ticket should I follow?

Thanks,

Daniel

comment:4 danielbachhuber3 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14084

comment:5 kawauso3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.