WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#1757 closed defect (bug) (fixed)

Category caculation not right

Reported by: Melodiefabrieknl Owned by: rob1n
Milestone: 2.2 Priority: normal
Severity: normal Version: 1.5.2
Component: Administration Keywords:
Focuses: Cc:

Description

On my site I have this subcategory 'Propellerhead Reason' showing it contains 29 posts. If I check the Admin-page (Manage-Categories) it states 30 posts!

This seems to be a bug. Are the developers aware of it?

Attachments (1)

bug1757.diff (1.3 KB) - added by graeme 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 graeme8 years ago

  • Owner changed from anonymous to graeme

The problem here seems to be that the admin page and the list_cats function are counting posts using different methods. list_cats is using joins to eliminate pages from inclusion, the admin page is not. For some reason pages are filed as having a category ID as one. This seems to be an desing flaw in pages.

I will attach a patch that makes the admin page list the number of posts in a category in the same way as list_cats, but the real problem is that pages really shouldn't have a category at all.

comment:2 graeme8 years ago

Done, by matching against post_status. It might be possible to do it cleaner -- I don't really understand joins.

graeme8 years ago

comment:3 graeme8 years ago

  • Keywords bg|2nd-opinion added; calculation bug categories category removed

comment:4 graeme8 years ago

  • Keywords bg|has-patch added

comment:5 rob1n7 years ago

  • Keywords bg|2nd-opinion bg|has-patch removed
  • Owner changed from graeme to rob1n
  • Status changed from new to assigned

comment:6 foolswisdom7 years ago

  • Milestone set to 2.2
  • Priority changed from high to normal

comment:7 johnbillion7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Closing as fixed. Function list_cats has been deprecated and replaced by wp_list_categories. Category count is now correct.

Note: See TracTickets for help on using tickets.