[wp-trac] [WordPress Trac] #62516: Multiple categories are unintentionally checked

WordPress Trac noreply at wordpress.org
Fri Nov 22 08:04:28 UTC 2024


#62516: Multiple categories are unintentionally checked
--------------------------+-----------------------------
 Reporter:  haniwaman     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.7.1
 Severity:  normal        |   Keywords:
  Focuses:  ui            |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62516>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list