Make WordPress Core

Opened 6 years ago

Last modified 3 months ago

#11302 new enhancement

Bulk editing posts should pre-fill fields with the same value / allow for removal

Reported by: pavelevap Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Quick/Bulk Edit Keywords: needs-patch
Focuses: Cc:


All I need is quickly move some posts from one category to another.

How to simulate this problem:

Create 2 posts in Uncategorized category.
Check both of them - Bulk actions - Edit.
There is no category selected even if both posts are in Uncategorized. When I check Category1 and click Update, both posts are now in Uncategorized and also in Category1. But no chance remove them from Uncategorized with Bulk actions.

Change History (25)

#1 @pavelevap
6 years ago

  • Cc pavelevap@… added

#2 @scribu
6 years ago

  • Component changed from UI to Administration
  • Keywords needs-patch added

Confirmed behaviour with 2.9-beta2.

#3 @scribu
6 years ago

  • Component changed from Administration to Quick Edit

Actually, no categories are checked!

#4 @scribu
6 years ago

  • Milestone changed from 2.9 to 3.0
  • Summary changed from Bulk actions for category change does not work to Can't removeCategories not checked in Quick edit
  • Type changed from defect (bug) to enhancement

The same goes for tags: the tag box will always be empty, even if both posts have one or more tags in common.

I think Quick Edit simply doesn't check similarities between posts at all, although it would be nice.

To get this working right will take some serious patching and a lot of testing. Punting to the next major release.

#5 @scribu
6 years ago

  • Summary changed from Can't removeCategories not checked in Quick edit to Bulk editing posts should pre-fill fields with the same value

#6 @nacin
6 years ago

  • Milestone changed from 3.0 to Future Release

No patch, punting.

#7 @scribu
6 years ago

Related: #12837

#8 @chased@…
5 years ago

I'd like to add that this seems to also appear when attempting to change Author with Bulk Edit. When doing so, changes are not saved.

#9 @helenyhou
3 years ago

Closed #21252 as a duplicate

#10 @SergeyBiryukov
2 years ago

Related: #19859, #24608

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#11 @helen
2 years ago

#24608 was marked as a duplicate.

#12 @helen
2 years ago

  • Summary changed from Bulk editing posts should pre-fill fields with the same value to Bulk editing posts should pre-fill fields with the same value / allow for removal

I could have sworn there was a comment to this effect somewhere already, but repeating it probably won't hurt.

There are two paths to allowing for removal of terms when it comes to UI + flow - that it can only be done when that term is already set for all posts in the selection (pre-filling with a check), or that we implement the indeterminate state (usually indicated by a checkbox with a dash through it) that allows the category to be removed from any posts that have that term set.

Implementation-wise, given that checkboxes don't send in the $_POST array when they aren't checked, a patch probably requires a good deal of thought. As noted in #8690, this is currently an add functionality, not replace. Indeterminate checkboxes are also not standardized in browsers or available in HTML.

Note that this only applies to hierarchical taxonomies. #19859 for non-hierarchical.

#13 @ubernaut
2 years ago

  • Cc ubernaut@… added

#14 @grahamarmfield
2 years ago

  • Cc graham.armfield@… added

#15 @joshcanhelp
15 months ago

This just recently came up in a project. The main issue is removing categories as they can be added in bulk with the current controls. Here are a few simpler options that came to mind:

1) Have the quick edit box react to whether you're already sorting by category in wp-admin. Above the list of posts, you have a category drop-down that shows posts within that category. The bulk edit function could key off of that and select the category you're currently viewing. If you submit and that category is gone, it's removed from the posts selected. This means you'd need to filter, select the posts, bulk edit, deselect, then save.

2) Another way to do this would be to have a separate category list for removal. It would show all categories that have posts assigned, all of them checked by default. You'd select the posts, bulk edit, deselect whatever categories you want to remove, then save. Any post that's selected would have the deselected categories removed.

Either one of those sound feasible?

#16 @ubernaut
15 months ago

personally i think the third mixed state/dashed indicator is the most elegant and conventional solution to this issue.

#17 @joshcanhelp
15 months ago

I definitely agree. I just figured one of these might be a good stop-gap solution (particularly the first since it's the least impactful on the UI as a whole).

The mixed-state checkbox, as Helen mentioned, is not available in HTML but there are good ways to implement with JS:


#18 @ubernaut
15 months ago

interesting never actually knew that guess that's my new thing of the day. thanks for the link!


Last edited 15 months ago by ubernaut (previous) (diff)

#19 @SergeyBiryukov
4 months ago

#33205 was marked as a duplicate.

#20 @Cyberchicken
4 months ago

@Helen: an old html trick to make checkboxes behave:
<input name="mycheckbox" value="nay" type="hidden">
<input name="mycheckbox" value="yes" type="checkbox">
You'll always be posted eithr a "nay" or a "yes".
Three-state require js for sure.

#21 @lau@…
3 months ago

I have a specific need and a simple suggested solution.

My store sells clothing so each season I add new clothes to the "New Arrivals" category and also to whatever category they will remain in over the long term e.g "Women's pants".
So every season I need to remove all the previous seasons clothes from the "New Arrivals" category, but I need them to remain in their other categories.

On the Edit Product Category page put a button at the bottom [ Remove all products from this Category ]

On the Product Categories list page add another Bulk Action "remove products from category"

In the short term I'd be happy if you could give me the sql to remove a categoryid from all products with that categoryid.

Thanks in advance

Last edited 3 months ago by lau@… (previous) (diff)

#22 @SergeyBiryukov
3 months ago

I've found the Batch-Move Posts plugin helpful as a workaround.

#23 follow-up: @ubernaut
3 months ago

so have we given up on the idea of making this a core feature? Seems to me a very basic UX feature that comes up in quite a few situations. I do also think that at some point (maybe in the past already) this becomes a competitive disadvantage versus other site building platforms. Relying on third party plugins to solve a common issue really seems less than ideal to me.

#24 in reply to: ↑ 23 @SergeyBiryukov
3 months ago

Replying to ubernaut:

so have we given up on the idea of making this a core feature?

I agree that it should be a core feature, we still need a patch though.

#25 @lau@…
3 months ago

I just tried the Batch-Move posts plugin but that only deals with post categories and posts. It doesn't deal with product categories and products.

I think I've figured out the SQL to do this. Can anybody tell me if I'm missing something?
In this case 493 is the term_id of the product category.

DELETE  term_relationships 
INNER JOIN term_taxonomy 
ON term_relationships.term_taxonomy_id = term_taxonomy.term_taxonomy_id
AND term_taxonomy.term_id = 493

UPDATE kry_term_taxonomy SET
count = 0
WHERE term_taxonomy.term_id = 493

ANOTHER SOLUTION which may be easier for you guys to implement as it eliminates a lot of complexity and potential for serious bugs and user misunderstanding is to have a second icon/link column in the Product Category page, next to the "Count" column. When clicked it takes you to a completely new page that lists all the products in the category (not the page that you go to when you click "count").
This new page has (at a minimum) a tickbox next to each product and two "Bulk Actions":
1) Remove from category
2) Add specified to category (you then have a dropdown with a list of categories at the top of the page)

I think this is probably the technically easiest solution and covers all the bases, even if some bases require a little extra user effort.
I think trying to do it through the bulk edit feature of the current product list page will be technically difficult for you guys and confusing for the user. The problem is how to indicate which categories are already allocated to the set of products, and especially the categories which are only allocated to a subset of the products (greyed out tickbox). I think that many users won't know what the greyed out tickbox represents and may tick or untick it incorrectly and then you get a lot of angry people who unwittingly removed or added a bunch of products to categories that they didn't mean to.

By creating the new page for products in a category you could even add an additional cool feature: you could use the term_relationships.term_order field to store the default order that the products should be displayed on the category page, and you could let the users specify the order by either:
1) a single field on each product row that you save using ajax to term_relationships.term_order
2) a funky feature to drag each product row into the proper order. (Best is to have both methods so that if you have 100 products in a category and you want to move a few from the top to much lower down don't have to do lots of scrolling/dragging.

Last edited 3 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.