Opened 2 months ago
Closed 2 months ago
#62516 closed defect (bug) (duplicate)
Multiple categories are unintentionally checked
Reported by: | haniwaman | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.7.1 |
Component: | General | Keywords: | |
Focuses: | ui | Cc: |
Description
There is a problem with the ID selector in the category checkbox function.
For example, when a category with ID:2 is selected, ID:20-29 is also selected at the same time.
[To check, please]
1.Open the edit screen of a WordPress post.
2.In the list of categories, check the category with a 1-digit ID
3.Confirm that categories with 2-digit IDs starting with the same number are also selected.
[Probable cause]
The cause may be that 'input[id^="in-" + a + "-" + i + '"]'
targets the selector with the first match when retrieving the checked categories in wp-admin/js/post.min.js.
When id="in-category-2-1"
is checked for first match, id="in-category-20-1"
to id="in-category-29-1"
are also selected.
[How to fix]
Instead of 'input[id^="in-' + a + '-' + i + '"]'
, use 'input[id="in-' + a + '-' + i + '"]'
so that only the target category is checked.
Duplicate of #62504.
Thanks for reporting the error!
It has been already reported in https://core.trac.wordpress.org/ticket/62504