WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#2359 closed defect (bug) (fixed)

Excess "Uncategorized" posts in post2cat table

Reported by: cre8d Owned by: nevans
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords: uncategorized posts has-patch
Focuses: Cc:

Description

I notice that I have a tonne of posts categorised as "Uncategorized" (as on the Manage Categories page), even though I don't have any posts categorised as "Uncategorized" any more (and indeed when you go to my category archive for uncategorised, there's no posts either). It's bothering me since I'm using a tag cloud plugin.

I had a look in post2cat table and the phantom uncategorized posts are listed in there. To see what these actually are, I went to

wp-admin/post.php?action=edit&post=

and entered in these post ids from post2cat where category_id = 1.

I got an error, of course, since the post wasn't there but I could see the preview window showing images that I'd uploaded to those posts which were once categorized with "Uncategorized".

Any idea what's going on? I'll try and investigate further.

Attachments (1)

functions-post.php.diff (2.1 KB) - added by nevans 8 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 davidhouse8 years ago

This is more of a support request, not a bug report.

http://wordpress.org/support

comment:2 cre8d8 years ago

I would say it's a bug if Wordpress isn't deleting the entry in post2cat?

comment:3 cre8d8 years ago

Ok, to follow up the bug is as follows:

  • Create entry, categorized as "Uncategorized"
  • Upload images for this entry
  • Publish entry
  • Delete entry
  • Relevant post2cat lines are not deleted.

comment:4 davidhouse8 years ago

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

If you mean:

  • The post2cat line for the deleted post isn't removed, worksforme.
  • The post2cat line for the attachment isn't removed, invalid. It's not meant to be. Attachments are stored as posts, so they have their own post2cat lines.

I suspect you meant the latter so I'm closing with invalid.

comment:5 davidhouse8 years ago

As always, reopen if I was wrong :)

comment:6 cre8d8 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I was referring to the post2cat line for the attachment isn't deleted, hence the category counts are incorrect.

comment:7 skeltoac8 years ago

  • Milestone set to 2.1

Attachment categories are mostly unused, yes. The category counts should probably be refined to exclude Attachments.

comment:8 davidhouse8 years ago

Two possible solutions to this:

  • We don't create post2cat lines for attachments
  • We ignore post_status="attachment" lines for the purposes of creating category counts.

Personally I think the former would be more useful as there's really no point clogging up tables with useless rows.

comment:9 cre8d8 years ago

Agreed - the first solution seems best.

comment:10 markjaquith8 years ago

  • Keywords bg|needs-patch added

comment:11 nevans8 years ago

  • Owner changed from anonymous to nevans
  • Status changed from reopened to new

nevans8 years ago

comment:12 nevans8 years ago

  • Keywords bg|has-patch added; bg|needs-patch removed
  • Status changed from new to assigned

Here's a patch. When applied, Wordpress will not create post2cat entries for attachments. It will, however, attempt to delete post2cat entries. I thought it to be prudent to leave that in so Wordpress would clean up its mess...

Regards.

comment:13 matt7 years ago

  • Milestone changed from 2.1 to 2.2

comment:14 foolswisdom7 years ago

  • Keywords has-patch added; bg|has-patch removed
  • Milestone changed from 2.2 to 2.3

comment:15 ryan7 years ago

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

I think this is fixed now with the move to taxonomy and everything else.

Note: See TracTickets for help on using tickets.