Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#2359 closed defect (bug) (fixed)

Excess "Uncategorized" posts in post2cat table

Reported by: cre8d's profile cre8d Owned by: nevans's profile 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 17 years ago.

Download all attachments as: .zip

Change History (16)

#1 @davidhouse
17 years ago

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

http://wordpress.org/support

#2 @cre8d
17 years ago

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

#3 @cre8d
17 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.

#4 @davidhouse
17 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.

#5 @davidhouse
17 years ago

As always, reopen if I was wrong :)

#6 @cre8d
17 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.

#7 @skeltoac
17 years ago

  • Milestone set to 2.1

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

#8 @davidhouse
17 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.

#9 @cre8d
17 years ago

Agreed - the first solution seems best.

#10 @markjaquith
17 years ago

  • Keywords bg|needs-patch added

#11 @nevans
17 years ago

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

#12 @nevans
17 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.

#13 @matt
17 years ago

  • Milestone changed from 2.1 to 2.2

#14 @foolswisdom
16 years ago

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

#15 @ryan
16 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.