Ticket #2789 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Cannot delete original default categories

Reported by: liquidcool Assigned to: westi
Priority: normal Milestone:
Component: Administration Version: 2.0.4
Severity: major Keywords: delete category has-patch
Cc:

Description

When trying to delete the default category Uncategorized, I receive a message saying:

Processing data...

but nothing follows. I had set another category (Everything) as the default. I tried to delete a 3rd category, and instead of its contents going to Everything, it went to Uncategorized. Apparently setting the default category ONLY affects the Category checkboxes on the Write Post page. Others have had a similar report trying to delete the Blogroll link category. I have been able to amass evidence from several posts, contained in these threads:

http://wordpress.org/support/topic/3655?replies=4#post-21653 http://wordpress.org/support/topic/65555?replies=4 http://wordpress.org/support/topic/66013?replies=4

While many recommend a workaround, it is basically, "don't do what you're trying to do", and isn't really acceptable. What if you want to transfer posts from one category to another, by deleting one and setting another to the default, as I tried to above? The system behavior (moving posts to the original default of Uncategorized, instead of the current default) is completely contrary to the user messages, leading to data corruption/pollution. The ability to batch modify posts in the admin panel would allow you to correct the damage, but that feature does not exist.

The message that displays the category that posts will be moved to is part of the problem. I have tracked that down that change:

http://trac.wordpress.org/changeset/3672

NOTE: my version is actually 2.0.3, which isn't an option below.

Good luck!

Attachments

2789.diff (0.9 kB) - added by westi on 06/06/06 21:23:35.
Patch for 2.0.4 to fix this
2789a.diff (1.4 kB) - added by westi on 06/07/06 07:36:25.
Improved patch - actually set the posts to the default cat not 1
2789b.diff (2.9 kB) - added by westi on 06/08/06 20:44:47.
Also remove delete link for default link category
2789c.diff (1.5 kB) - added by westi on 10/02/06 20:56:53.
The missed hunk from 2789b that didn't make it

Change History

06/06/06 07:46:58 changed by westi

That changeset is on trunk not the 2.0 branch and was never applied to 2.0.3 so cannot be the issue here.

However some of the fixes made on trunk may be missing for 2.0.3 in this area.

06/06/06 07:52:30 changed by westi

  • keywords changed from delete category to delete category bg|dev-feedback.
  • milestone set to 2.0.4.

I think we need to apply the fix from [3675] in relation to #2609 here so as to ensure we block the deletion of default cats with nice message

06/06/06 07:55:36 changed by westi

  • keywords changed from delete category bg|dev-feedback to delete category bg|needs-patch.
  • owner changed from anonymous to westi.
  • status changed from new to assigned.

We also need to patch admin-db.php to fix "wp_delete_category" which referrers to cat_ID 1 as the default category still.

That should then fix this for 2.0.4 :-)

I'll knock up a patch later if someone doesn't beat me to it.

06/06/06 21:23:35 changed by westi

  • attachment 2789.diff added.

Patch for 2.0.4 to fix this

06/06/06 21:24:35 changed by westi

  • keywords changed from delete category bg|needs-patch to delete category bg|has-patch.

The attached patch backports the changes from trunk to 2.0.4 for this including the belt and braces in categories.php

06/07/06 07:27:51 changed by westi

Hmm I'm not sure this patch completely addresses the problems here.

I have just checked my test blog again and the posts have not been moved to the default category :-(

06/07/06 07:29:56 changed by westi

Yep wp_delete_category is still broken:

$wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");

New patch incoming

06/07/06 07:36:25 changed by westi

  • attachment 2789a.diff added.

Improved patch - actually set the posts to the default cat not 1

06/07/06 07:37:04 changed by westi

That new patch should fix it.

Not tested but the bug is obvious ;-)

06/08/06 20:44:47 changed by westi

  • attachment 2789b.diff added.

Also remove delete link for default link category

06/08/06 20:45:39 changed by westi

I noticed while fixing #2806 that you can attempt to delete the default link cat too.

Extend this patch to cover that as well.

07/23/06 18:27:01 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [4032]) Default cat deletion fix from westi. fixes #2789

08/14/06 02:29:03 changed by war59312

  • status changed from closed to reopened.
  • version changed from 2.0.2 to 2.0.4.
  • resolution deleted.
  • milestone changed from 2.0.4 to 2.1.

This patch does not seem to be 100% .

In Wordpress 2.0.4 you still cant delete the Blogroll Link Category. You do not get an error message and all you see on the screen is "Processing Data..." .

So either you need to display the error saying you can not delete the default category or fix it so you can. I hope you allow the second option in this case. ;)

08/14/06 21:36:13 changed by ryan

Sounds like we forgot to handle the AJAX route.

10/02/06 20:56:53 changed by westi

  • attachment 2789c.diff added.

The missed hunk from 2789b that didn't make it

10/02/06 20:57:47 changed by westi

  • keywords changed from delete category bg|has-patch to delete category has-patch.
  • milestone changed from 2.1 to 2.0.5.

We need to make sure we don't show the delete link for the default cat in 2.0.5

10/02/06 21:14:27 changed by markjaquith

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [4271]) Default cat deletion fix from westi (part 2). fixes #2789

11/30/06 19:41:51 changed by

  • milestone deleted.

Milestone 2.0.5 deleted