#62504 closed defect (bug) (fixed)
Checking "Uncategorized" category adds all categories with an ID starting with 1
Reported by: | ffffelix | Owned by: | azaozz |
---|---|---|---|
Milestone: | 6.7.2 | Priority: | normal |
Severity: | normal | Version: | 6.7.1 |
Component: | Editor | Keywords: | has-patch has-testing-info fixed-major dev-reviewed |
Focuses: | javascript | Cc: |
Description
In the Classic Editor, checking the "Uncategorized" checkbox (tag ID 1) also checks/unchecks all categories with an ID where the first digit is 1 (e.g. 1, 10, 100, 1000).
New in 6.7.1, likely related to #62440.
Steps to reproduce in WordPress Playground:
- Activate Classic Editor plugin
- Create 11 categories – these will have IDs 2 through 12
- On post edit screen, check "Uncategorized" checkbox
- All categories with ID starting with a "1" are checked
Attachments (3)
Change History (46)
This ticket was mentioned in PR #7863 on WordPress/wordpress-develop by @ffffelix.
2 months ago
#1
- Keywords has-patch added
Fixes category checkboxes in v6.7.1.
This change makes matching the desired tag ID to its checkbox elements more strict.
Example: when selecting a category with an ID of 1, the jQuery selector would also match the checkboxes for any category with an ID starting 1 (e.g. 10, 110, 1043).
The checkbox IDs are output via wp_unique_prefixed_id
so should always have a trailing slash after the ID.
Trac ticket: https://core.trac.wordpress.org/ticket/62504
#2
@
2 months ago
After further testing, an additional requirement to trigger the bug is that the inital clicked category must be in both the "All categories" and "Most used" lists — i.e. have more than one checkbox on the page.
#3
@
2 months ago
- Milestone changed from Awaiting Review to 6.7.2
Thanks for this report, @ffffelix.
Moving to 6.7.2 to continue investigating.
#4
@
2 months ago
- Keywords needs-testing added
Can reproduce it. Yes, the selector is too general, needs to be stricter. The PR seems to fix it here but better to test it more.
@ironprogrammer commented on PR #7863:
2 months ago
#5
Thanks for the patch, @ffffelix!
I was also able to reproduce this issue by unchecking and re-checking "Uncategorized" (used https://playground.wordpress.net/#{%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22features%22:{%22networking%22:true},%22login%22:true,%22landingPage%22:%22/wp-admin/post.php?post=1&action=edit%22,%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%226.7.1%22},%22steps%22:[{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22classic-editor%22}},{%22step%22:%22wp-cli%22,%22command%22:%22wp%20term%20generate%20category%20--count=11%22}} this Playground link] that generates the terms).
To test the patch, the default Playground link works fine if you go through the repro set up steps. But https://playground.wordpress.net/?core-pr=7863#{%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22features%22:{%22networking%22:true},%22login%22:true,%22landingPage%22:%22/wp-admin/post.php?post=1&action=edit%22,%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%226.7.1%22},%22steps%22:[{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22classic-editor%22}},{%22step%22:%22wp-cli%22,%22command%22:%22wp%20term%20generate%20category%20--count=11%22}} try out this one] that combines the repro test with the PR (takes longer to load in order to build the PR patch).
These links will look kinda nasty in Trac, but I'll share a formal test report there.
#6
@
2 months ago
- Keywords has-testing-info added
Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/7863
Environment
- Playground (see this PR comment for repro and patch testing links)
- PHP: 8.0
- WordPress: 6.7.1
- Active Plugins:
- Classic Editor 1.6.5
Actual Results
With Classic Editor active for the post:
- ✅ Checking the "Uncategorized" category does not automatically check categories with IDs beginning with
1
. - ✅ With categories whose IDs begin with
1
checked, unchecking the "Uncategorized" category does not automatically uncheck them.
Confirmed issue does not surface with block editor active for post.
#8
@
2 months ago
We see this behavior also (you got ticket up a few ahead of me). In our case, using PHP 7.4x, 6.7.1; classic editor; we see random batches of pre-selected categories. We don't have uncategorized cat as not normal for a news portal :) So, we see main cats, and sub-cats selected. Like, more than 25+ selected and only fix is going into category selector and manually 'unchecking.' So, pre checked "business," "Florida" "California --> San Diego," "Medical" etc.
Folks are on top of this already it looks like, just adding to the foam and fray. :)
#9
@
2 months ago
Our issue - initial start post, no items selected, then upon selecting item, huge number of items get selected.
#10
@
2 months ago
wp-fix-62504.zip is a hotfix plugin that replaces the post.js file with a fixed version. If it works well this code will probably be added to the official WordPress hotfix plugin.
Please test!
#11
@
2 months ago
Test Report
Patch tested: https://core.trac.wordpress.org/attachment/ticket/62504/wp-fix-62504.zip
Environment
PHP: 8.0
WordPress: 6.7.1
Active Plugins:
Classic Editor 1.6.5
Actual Results
With Classic Editor active for the post:
✅ When we are checking the "Uncategorized" category it does not automatically check categories with IDs beginning with 1.
✅ Also, with categories whose IDs begin with 1 checked, unchecking the "Uncategorized" category does not automatically uncheck them.
This ticket was mentioned in Slack in #core-test by zunaid321. View the logs.
2 months ago
#13
@
2 months ago
Tested link
Environment
PHP: 8.0
WordPress: 6.7.1
Active Plugins:
Classic Editor 1.6.5
Actual Results
With Classic Editor active for the post:
When we select the "Uncategorized" category, categories with IDs starting with 1 are not automatically selected. Additionally, if categories with IDs starting with 1 are already checked, unchecking the "Uncategorized" category does not automatically uncheck them.
#14
@
2 months ago
Reproduction Report
Description
This report validates whether the issue can be reproduced, but not exactly in the manner described above. In my case, additional categories 1 and 2 were selected.
Environment
- WordPress: 6.7.1
- PHP: 8.1.29
- Server: nginx/1.16.0
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.29)
- Browser: Chrome 129.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.0
- MU Plugins: None activated
- Plugins:
- Classic Editor 1.6.5
- Test Reports 1.2.0
Actual Results
- ✅ Checking 'Uncategorized' selects other options (not the one suggested above, i.e., all with 1's). In my case, 1 and 2 were selected.
Supplemental Artifacts
Video https://jmp.sh/SSDFKPiK
#17
@
2 months ago
I have a problem with categories that start with the number 34 (34, 345, 341 etc.). This fix does not work in my case. I reverted to ver. 6.7 and now everything works as it should.
#19
@
2 months ago
[*WORKS*]
The hot pix used as WP plugin (not called directly for those who were confused on where to put it), worked for us in our situation. Now, when doing new post, clicking on 'business' or 'AP' no longer auto selects 40 other random cats and sub-cats in the category picker/seelctor box. We had no issue with 'uncategorized' as we always delete that.
THANKS @azaozz
#20
@
2 months ago
I've verified that the hotfix plugin shared in comment:10 addresses the issue. Thanks, @azaozz!
Test Report
Patch tested: attachment:wp-fix-62504.zip
Environment
- Playground (see this PR comment for repro testing link -- not the patch testing link)
- PHP: 8.0
- WordPress: 6.7.1
- Active Plugins:
- Classic Editor 1.6.5
- Fix for Trac ticket 62504 (uploaded to Playground)
Actual Results
With Classic Editor active for the post:
- ✅ Checking the "Uncategorized" category does not automatically check categories with IDs beginning with 1.
- ✅ With categories whose IDs begin with 1 checked, unchecking the "Uncategorized" category does not automatically uncheck them.
#21
@
2 months ago
Reply to @im3dabasia1:
Thanks for sharing your testing details! Would you be able to confirm the initial digit(s) of the category whose selection causes other categories to be selected as well? What are the IDs of "Uncategorized", "cat 1", and "cat 2"?
For example, the first set of IDs in this example all begin with 1
: 1, 10, 11, 12
, and are caught up when the first is checked:
#22
@
2 months ago
Reply to @whitedd:
Would you please share how you tested the patch or hotfix plugin? It would help ensure that the patch addresses all variations of this issue. Thanks!
#23
@
2 months ago
Updated the hotfix plugin to only replace post.js in WP 6.7.1 and to check if another plugin has already replaced it. Also removed the old version of the plugin.
If you've downloaded the old hotfix, please update it!
#24
@
2 months ago
- Resolution set to fixed
- Status changed from new to closed
Committed the patch from the PR to trunk in [59454] but seems Trac has a bad day. Here's the commit on GitHub.
In: [59454]
Editor: Fix selecting/deselecting multiple unwanted categories when clicking on a Category checkbox on the old Edit Post screen.
Props ffffelix, desrosj, ironprogrammer, neotrope, narenin, zaoyao, im3dabasia1, cbravobernal, azaozz.
Fixes #62504.
#25
@
2 months ago
- Keywords fixed-major added; needs-testing removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopen for 6.7.2.
This ticket was mentioned in Slack in #core by azaozz. View the logs.
8 weeks ago
#33
@
8 weeks ago
- Keywords dev-reviewed added
@azaozz [59454] looks good to merge to the 6.7 branch.
#34
@
8 weeks ago
- Owner set to azaozz
- Resolution set to fixed
- Status changed from reopened to closed
In 59468:
#39
@
7 weeks ago
Hi there is another version of the hotfix that fixes a problem with the translations. Please test!
#41
@
4 days ago
Confirmed this issue an issue with 6.7.1 and custom taxonomies(WooCommerce product_cat
). Installed the v3 hotfix plugin, and it seems to have resolved the issue.
#42
@
3 days ago
The latest patch doesn't seem to be fixing it as well. It uses the incomplete selectors. Id for the checkbox and li is in the format of {id}-1 or {id}-2. So we need to consider the last number as well.
We need to use below selector to fix this.
$('input#in-' + taxonomy + '-' + id + '-1' + ', input[id^="in-' + taxonomy + '-' + id + '-2"]')
Demo