#25811 closed defect (bug) (invalid)
Draft posts do not display in control panel posts listing when no category has been checked.
| Reported by: | interjinn | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 1.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
The issue is specific to the following code found in wp-includes/taxonomy.php (line 756 of current trunk):
$join .= " INNER JOIN $wpdb->term_relationships";
When no categories are checked then the use of INNER JOIN causes the draft to be excluded. This should probably be a left join to ensure such draft posts are caught. I don't feel confident enough with WordPress core to generate a patch since this could have consequences elsewhere in the application, but would like for the issue to be considered. Related to such a change would be to change the following (line 760):
$where[] = "$alias.term_taxonomy_id $operator ($terms)";
To something like the following:
$where[] = "$alias.term_taxonomy_id IS NULL OR $alias.term_taxonomy_id $operator ($terms)";
Cheers,
Rob.
Change History (4)
#2
@
13 years ago
You are right. I had only updated the code to trunk and reloaded my problem post. The issue persisted and so I thought it was a prevailing bug since the inner join was also still in the code. I see now though that if I edit the post or create a new one the "Uncategorized" option is now present and checked where in my production version this is not yet an available feature. it will most like become a non-issue in the near future when we update to latest. Thank you for your time and feedback!
Cheers,
Rob.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
WordPress has a concept of default category for posts. Every time a post is saved, even as a draft, without a checked category, the default category is used. You are also not able to delete the default category through the UI.
I'm not able to reproduce this on a clean install of WP 3.7.1.
It may be desirable to make this work when there is no valid default category, for some reason, even if this situation should not be possible to get into, with plain WordPress core. Then as an enhancement.