Make WordPress Core

#62516 closed defect (bug) (duplicate)

Multiple categories are unintentionally checked

Reported by: haniwaman Owned by:
Priority: normal Milestone:
Component: General Version: 6.7.1
Severity: normal Keywords:
Cc: Focuses: ui

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.

Attachments (2)

画面収録 2024-11-22 16.50.49.mov​ (1.7 MB ) - added by haniwaman 23 months ago.
62516.diff​ (597 bytes ) - added by haniwaman 23 months ago.

Download all attachments as: .zip

Change History (3)

@haniwaman
23 months ago

#1 @cbravobernal
23 months ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of #62504.

Thanks for reporting the error!

It has been already reported in https://core.trac.wordpress.org/ticket/62504

Note: See TracTickets for help on using tickets.