#14344 closed defect (bug) (worksforme)
wp_dropdown_categories, show_count=1 counts unpublished posts as well
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Taxonomy | Keywords: | wp_list_categories |
Focuses: | Cc: |
Description
When using the function
wp_dropdown_categories
and setting the argument
show_count=1
Wordpress will also count posts which are not published.
I tested it with different combinations of parent categories and child categories. It is always the same.
I checked on Windows/Apache and Unix/Lamp.
Change History (8)
#2
@
14 years ago
- Cc dcowgill@… added
Yeah, I'm having the same issue with wp_list_categories(). It appears to be missing something like:
$where .= " AND post_status = 'publish'";
I believed it needs to be added in the 'get_terms' function but don't know how to fix it exactly.
#5
follow-up:
↓ 6
@
14 years ago
- Keywords dev-feedback added
The count column is COUNTed from the term_relationships table, which doesn't know about the statuses of its object_ids.
Fixing would involve filtering the query in wp_update_term_count_now()
.
#6
in reply to:
↑ 5
@
14 years ago
Replying to mdawaffe:
The count column is COUNTed from the term_relationships table, which doesn't know about the statuses of its object_ids.
Fixing would involve filtering the query in
wp_update_term_count_now()
.
Um... I think I'm lying. I thought I could reproduce, but can't now. Looking more.
#7
@
14 years ago
- Component changed from General to Taxonomy
- Keywords dev-feedback removed
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
OK. I can't reproduce this bug. And this situation is exactly what $taxonomy->update_count_callback
is for.
Closing as WFM. If you can still reproduce with WordPress trunk, please reopen with more details.
Does wp_list_categories() behave the same?