WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13397 closed defect (bug) (fixed)

Bulk Edit - Changing cats kills tags

Reported by: ipstenu Owned by:
Milestone: 3.0 Priority: normal
Severity: blocker Version: 3.0
Component: General Keywords:
Focuses: Cc:

Description

I've got two posts, neither are in a category.

Post 1 - tags1, tag2
Post 2 - tag3, tag4

I select both to bulk edit and put them in the same cat. I click on CAT1 and hit save.

They're both in the same cat now, but all my tags are done.

You are using WordPress 3.0-beta2-14565. <<

Running single site.

Attachments (3)

13397-bulk-cats.diff (1.4 KB) - added by duck_ 4 years ago.
13397-qe-remove-cats.diff (706 bytes) - added by duck_ 4 years ago.
13397-bulk-cats.2.diff (1.1 KB) - added by duck_ 4 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 ipstenu4 years ago

Tag are GONE. Not done. Dude. Sleep moar!

comment:2 follow-up: nacin4 years ago

  • Milestone changed from Unassigned to 3.0
  • Severity changed from normal to blocker

I can't reproduce.

However, I am discovering two other quick/bulk edit bugs here. One of them is a regression, the other exists in 2.9.

  1. Attempt to remove all categories from a post via Quick Edit. Expected: all will be removed. Actual: None will be removed. Sounds like maybe it is expecting Uncategorized to remain (or become) checked in that case. This is 2.9 and 3.0.
  1. In 3.0, I am unable to add categories via Bulk Edit. They simply won't save. This is a regression and cripples hierarchical taxonomy handling in Quick Edit. Marking as blocker for this reason.

comment:3 nacin4 years ago

With regards to the blocker, it looks like we're still using old post_category[] markup. there, instead of the new tax_input[category][]. A custom hierarchical taxonomy saves just fine as it uses the newer markup. Seems simple to patch.

comment:4 ipstenu4 years ago

Per nacin's suggestion, I upgraded to the latest nightly.

I confirm his issue with not being able to add categories AND that my editing no longer munches my tags.

comment:5 in reply to: ↑ 2 ; follow-up: azaozz4 years ago

Replying to nacin:

  1. Attempt to remove all categories from a post via Quick Edit.

Since its introduction Quick Edit only adds tags and categories. There were talks about implementing removal too but that was never a high priority. There are some UX questions too: shall we add extra boxes with the existing cats, tags, etc. (that may be more confusing) or shall we add a red checkbox above the existing cats saying "Remove checked categories from the selected posts". Or perhaps radio buttons Add (default) / Remove.

comment:6 in reply to: ↑ 5 ; follow-up: nacin4 years ago

Replying to azaozz:

Replying to nacin:

  1. Attempt to remove all categories from a post via Quick Edit.

Since its introduction Quick Edit only adds tags and categories. There were talks about implementing removal too but that was never a high priority. There are some UX questions too [...]

I imagine you're referring to Bulk Edit. I agree with its current functionality.

I'm referring to Quick Edit. It prepopulates so you can remove/add at will. The only thing you can't do is remove all categories from a post, presumably due to code that handles removing the default category. So if you try to remove the Fruit category and Uncategorized, it won't remove either (if it has no other categories beyond those two). If you try to remove just Fruit, it'll do so. It's an odd case of functionality presumably due to the default category, and I'm much less concerned about that. (It's also not a regression.)

duck_4 years ago

comment:7 follow-up: duck_4 years ago

As suggested change markup to new tax_input, doesn't fix quick edit cat removal.

comment:8 follow-up: duck_4 years ago

I think the reason for Quick Edit not allowing you to remove all categories is because the jQuery serialize method doesn't pickup the catgories if all the boxes are unchecked (see inline-edit-post.js)

comment:9 in reply to: ↑ 6 azaozz4 years ago

Replying to nacin:

I imagine you're referring to Bulk Edit. I agree with its current functionality.

You're right. Got confused by the ticket's title, sry.

comment:10 in reply to: ↑ 8 duck_4 years ago

Replying to duck_:

I think the reason for Quick Edit not allowing you to remove all categories is because the jQuery serialize method doesn't pickup the catgories if all the boxes are unchecked (see inline-edit-post.js)

I tell a lie... in fact it's to do with how wp_update_post handles an empty post_category[] array. Patch uses the trick used in the categories meta-box of adding an input with a fake term id.

duck_4 years ago

duck_4 years ago

comment:11 in reply to: ↑ 7 duck_4 years ago

Replying to duck_:

As suggested change markup to new tax_input, doesn't fix quick edit cat removal.

As discussed on IRC the changing the markup isn't the main issue.

The way wp_insert_post works is by setting categories from post_category first and then from tax_input[category] so when bulk_edit_posts sets tax_input[category] after the new cats passed from the checkboxes any changes are accidentally overwritten in wp_insert_post.

comment:12 ryan4 years ago

(In [14723]) Fix adding categories via bulk edit. Props duck_. see #13397

comment:13 ryan4 years ago

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

(In [14724]) Allow removing all categories via quick edit. Props duck_. fixes #13397

Note: See TracTickets for help on using tickets.