Make WordPress Core

Opened 14 years ago

Last modified 3 months ago

#11302 assigned enhancement

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

Reported by: pavelevap's profile pavelevap Owned by: francina's profile francina
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Quick/Bulk Edit Keywords: needs-patch needs-design
Focuses: javascript, administration 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.

Attachments (1)

bulk-edit-post-category.2.png (162.4 KB) - added by francina 3 years ago.
Screenshot of the bulk editing panel with undetermined state for checkboxes

Download all attachments as: .zip

Change History (66)

#1 @pavelevap
14 years ago

  • Cc pavelevap@… added

#2 @scribu
14 years ago

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

Confirmed behaviour with 2.9-beta2.

#3 @scribu
14 years ago

  • Component changed from Administration to Quick Edit

Actually, no categories are checked!

#4 @scribu
14 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
14 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
13 years ago

  • Milestone changed from 3.0 to Future Release

No patch, punting.

#7 @scribu
13 years ago

Related: #12837

#8 @chased@…
12 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
11 years ago

Closed #21252 as a duplicate

#10 @SergeyBiryukov
10 years ago

Related: #19859, #24608

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

#11 @helen
10 years ago

#24608 was marked as a duplicate.

#12 @helen
10 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
10 years ago

  • Cc ubernaut@… added

#14 @grahamarmfield
9 years ago

  • Cc graham.armfield@… added

#15 @joshcanhelp
9 years 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
9 years ago

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

#17 @joshcanhelp
9 years 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
9 years ago

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


Last edited 9 years ago by ubernaut (previous) (diff)

#19 @SergeyBiryukov
8 years ago

#33205 was marked as a duplicate.

#20 @Cyberchicken
8 years 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@…
8 years 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 8 years ago by lau@… (previous) (diff)

#22 @SergeyBiryukov
8 years ago

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

#23 follow-up: @ubernaut
8 years 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
8 years 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@…
8 years 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 8 years ago by SergeyBiryukov (previous) (diff)

#26 @SergeyBiryukov
8 years ago

#34849 was marked as a duplicate.

This ticket was mentioned in Slack in #core by benoitchantre. View the logs.

7 years ago

#28 @Marcoevich
7 years ago

Hi guys I was wondering if there's any progress on this one?

#29 @ubernaut
7 years ago

doesn't seem like it :(

#30 @SergeyBiryukov
7 years ago

#35548 was marked as a duplicate.

#31 @tomybyte
7 years ago

No question, if you can bulk add a category, you just should be able to remove it.
I just had the experience to mark the wrong category in bulk edit for a lot oft posts. Just saw that while clicking on the submit button. But it was to late, I just had added the wrong category.
Now I have to change this for every post. Ok with quickedit it won't take so long, but anyway it is annoying not being able to correct such a mistake in bulk edit.

#32 @thinkluke
7 years ago

Agreed, this would be a nice core feature.

This ticket was mentioned in Slack in #forums by sergey. View the logs.

6 years ago

#34 @dd32
6 years ago

#40918 was marked as a duplicate.

#35 @dd32
6 years ago

#40801 was marked as a duplicate.

#36 @SergeyBiryukov
6 years ago

#41964 was marked as a duplicate.

#37 @Virtality Marketing Solutions
6 years ago

WordPress team, why is this feature taking so long? People have been asking for it for years and it makes managing products and large blogs a real pain. This is why people are now moving to solutions like Shopify. I'm a huge WordPress fan and want to stay one :-) Please get this one on deck please please :-)

#38 @Michalooki
6 years ago

If it is not possible for now to add this feature of pre-fill fields with the same value / allow for removal,
Will it be possible to to add some kind of extra field that allow to make a bulk removal of a category from a list of posts? This will help alot. Thanks.

#39 @ubernaut
6 years ago

Seems hard for me to believe, not actually being a programmer myself, that none of these people who keep bringing this up have the skills to implement this or that the powers that be arent sick of marking other tickets as duplicates.

Obviously, there is demand and we've had the UX worked out for years now. This is a very basic problem and i feel like it may signify a greater problem with the whole process of waiting till some one person or group who happens to have the capability to do something about it cares enough about this specific thing to do something.

Meanwhile, a great number of people pay the price through clunky and arduous UX. Bulk de-selection is not rocket science and we should not be treating it as such, imo.

#40 @dmsnell
6 years ago

After some conversations today I stumbled upon this ticket after thinking, "if the ability to bulk-remove categories isn't in WordPress already it must have some challenging long-term issues." Turns out I was right! Anyway I'd love to try and eye this ticket for Contributor Day at WordCamp US 2017 and on that hope would love to get some conversation/feedback started here so I can prepare for it.

Since it's been four years since issues with browser compatibility for indeterminate checkboxes was discussed I decided to look it up: all major browsers should support the tri-state box but it's still not possible to indicate that indeterminate state with HTML only - one must use JavaScript.

Question one is how we feel about the tri-state checkbox in general. Is it the right idiom? I wasn't sure if the indeterminate state should imply that the category should be removed or if it would mean we aren't intending on changing the category. My conclusion was that unchecked should imply removing the category, checked should imply adding the category, and indeterminate should imply not changing anything.

Maybe on account of this confusion I had a hard time seeing the tri-state actually solving our wants. It's almost as if we need something else in addition to the checkbox.

Question two is how important it is to us that this all work without JavaScript. I believe that we should be able to figure out how to make this all work with the appropriate scripting before submitting the form, but does the form have to be able to work without it? The list of posts to the left of the category box appears to already rely on JavaScript for its functioning.

Question three is maybe less important for discussion because we can always "make it work" but how should we represent this on the API side. My guess is that we can probably add some new "categories to remove" attribute in the request.

It was hard for me to think up examples of existing UI for this purpose. LightRoom doesn't use checkboxes: they have tag names, tag names with a star at the end, and the absence of tag names to indicate "all items have this tag," "some items have this tag," and "no items have this [non-visible] tag." It doesn't list all of the available tags either, which is a bit simpler than our category bulk edit box.

After some doodling I came up with an idea which would indicate both the addition or not of a category as well as its removal: a hoverable x to the left of the checkmark. The video below is crude and a prototype and is only there for the idea. The picture shows one way we might be able to indicate that a category is on the removal list.

This makes me wonder too if a radio button isn't technically more appropriate. Of course the styling would need to be made nice but I think we're truly dealing with a tai-state field: add to all, remove from all, or leave them all as they are.

Could we style a radio button in a way that communicates these states the way we want?

Anyway, thanks to all who provide feedback here. Once I have a better idea of what we would want to build I can work on creating a patch.

#41 @ubernaut
6 years ago

Thanks, @dmsnell for your thoughtful response and willingness to chip in to try to make this happen. :) My vote on Q1 is for the Tri state (dashed checkbox) UI at this point. It is the only solution to this issue i've ever seen used anywhere else. You cannot set the third state it is always preset to indicate a mixed selection. Unchecking it sets all selected items to the false state, checking it sets all to true, not clicking simply leaves everything the way it is.

Not saying it's the best solution but it is the simplest, most intuitive one imo, at least that ive seen to date.

No opinion on Q 2 or 3 bc i cant code my way out of a paper bag, sorry.

Last edited 6 years ago by ubernaut (previous) (diff)

#42 @itecrs
5 years ago

There is no need for complicated solutions. All it takes is one more checkbox named "Remove previous categorization" and couple of lines of code. If you check this box, it will clear category info for selected products, and set new categorization as you select in list of categories. If you not check this box, it will work the way it does already.

#43 @pannelars
5 years ago

Still no plan for a release?? Miss this function

#44 @WHSajid
5 years ago

Looks like there's no solution to this yet. In the meantime, can I request a filter inside the bulk_edit_posts function? Possibly around the part where the new categories are being merged with the old ones? (Line 566-570 in includes/post.php) So that a simpler plugin can be developed (without creating an entire bulk edit plugin) to allow users to completely override existing categories. I know it's an ugly bandaid on a serious wound, but I think it can be a temporary relief.

#45 @ubernaut
5 years ago

there is a solution but nobody wants to code it up.

This ticket was mentioned in Slack in #core by francina. View the logs.

4 years ago

#47 @samba45
4 years ago

Possible solution, interrupt the SQL relationship between post and category with scripts from phpmyadmin.
Of the type:
Suppose we have the table prefix wp_blog, launching the command "delete from wp_blog_term_relationships where term_taxonomy_id = 1 and object_id in (select id from wp_blog_posts where post_type = 'post' and post_status = 'publish');" we break the correlation between the two elements (post and uncategorized) this action has value only on the post set to "published".
We report the counter value of the uncategorized category.
From phpmyadmin:
"Update wp_blog_term_taxonomy set count = 0 where term_taxonomy_id = 1;"
Method to use with caution, risk damaging SQL database, make backups before any action.
Result: Removes "uncategorized from posts"

Last edited 4 years ago by samba45 (previous) (diff)

#48 @Mte90
4 years ago

Looking also at the other ticket seems that we need to do a new UI to manage better the categories in the bulk mode specifically on to remove the categories itself from the posts.
So probably is more on javascript side than in PHP and we need to investigate also what is the best place for that code.
Maybe we need to see also the bulk edit mode why is not generating rightly the UI, maybe is something that should be splitted in two parts and one involve also the Design team?

#49 @johnbillion
4 years ago

  • Keywords needs-design added

Yeah this needs some design work and consideration of using the indeterminate state for checkboxes, similar to how Gmail does when bulk managing labels on emails.

#50 @tomluckies
3 years ago

Plugin for anyone looking for a solution in the meantime:

This ticket was mentioned in Slack in #core by soulseekah. View the logs.

3 years ago

#52 @soulseekah
3 years ago

Hey, we're looking at this ticket at WCEU2020, if anyone is interested in contributing thoughts, code, etc. please hop onto Slack #core channel.

#53 @soulseekah
3 years ago

I think that using is actually one of the best approaches with little overhead. But I'm not sure whether it works well or not, I had to hack it up a bit.

This is a feature plugin for this issue

Let's see if we can test this (especially UI/UX-wise) and get something more solid going. It will need at least one new filter, and edit.js will contain the JS blob that I put in my code (yes, yes, kittens died, inline JS, inline CSS, yes, sorry).


#54 @francina
3 years ago

Thanks @soulseekah - with a small delay of 3 months I tested this and on WordPress 5.6-alpha-48783, Chrome Version 84.0.4147.125
It works!

So, what's next? :-)

Is the indeterminate checkbox state supported by all the browsers that WordPress supports?

3 years ago

Screenshot of the bulk editing panel with undetermined state for checkboxes

#55 @francina
3 years ago

  • Focuses javascript administration added

Tested again on web site running WordPress 5.6 RC1, PHP 7.3.2, on MacOs BigSur.

Next steps

  1. Review code
  2. Turn it into a patch
  3. Cross-browser testing of the undetermined checkboxes styling (separate ticket?)

#56 @ubernaut
3 years ago

@francina looks great to me! :)

This ticket was mentioned in Slack in #core by francina. View the logs.

3 years ago

#58 @SergeyBiryukov
3 years ago

  • Milestone changed from Future Release to 5.7

Moving to the milestone to test the approach suggested in comment:53, which appears to have some consensus.

#59 @SergeyBiryukov
3 years ago

  • Owner set to francina
  • Status changed from new to assigned

This ticket was mentioned in Slack in #design by hellofromtonya. View the logs.

2 years ago

#61 @francina
2 years ago

  • Milestone changed from 5.7 to Future Release

This ticket was mentioned in Slack in #core by francina. View the logs.

2 years ago

This ticket was mentioned in Slack in #core by francina. View the logs.

22 months ago

#64 @SergeyBiryukov
13 months ago

#55757 was marked as a duplicate.

This ticket was mentioned in Slack in #core by francina. View the logs.

3 months ago

Note: See TracTickets for help on using tickets.