[wp-trac] [WordPress Trac] #62440: "Most Used" Category Tabs Not Synced with "All Categories" Tab in Classic Editor

WordPress Trac noreply at wordpress.org
Fri Nov 15 11:48:41 UTC 2024


#62440: "Most Used" Category Tabs Not Synced with "All Categories" Tab in Classic
Editor
--------------------------+-----------------------------
 Reporter:  charleslf     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 == Description ==

 When using the Classic Editor, the "Most Used" category tabs are not
 properly synced with the "All Categories" tab. This issue appears to have
 been introduced after the fix for
 [#61014](https://core.trac.wordpress.org/ticket/61014), as the code block
 in `post.js` does not reflect the updated ID structure.

 == Steps to Reproduce ==

 # Go to the "Posts" section in the WordPress admin panel.
 # Add or edit a post.
 # Open the "Categories" meta box.
 # Notice that when selecting categories from the "All Categories" tab, the
 selections do not update the "Most Used" tab, and vice versa.
 # This behavior occurs when the Classic Editor is enabled.

 == Expected Behavior ==

 The "Most Used" category tab should automatically sync with the "All
 Categories" tab, maintaining consistency between the two views.

 == Actual Behavior ==

 The "Most Used" category tab is not updated when categories are selected
 or deselected in the "All Categories" tab.

 == Code Analysis ==

 The bug appears to be related to the following block of code in `post.js`:

 {{{
   // Sync checked items between "All {taxonomy}" and "Most used" lists.
   $('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on(
       'click',
       'li.popular-category > label input[type="checkbox"]',
       function() {
           var t = $(this), c = t.is(':checked'), id = t.val();
           if ( id && t.parents('#taxonomy-'+taxonomy).length )
               $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy
 + '-' + id).prop( 'checked', c );
       }
   );
 }}}

 This block does not seem to account for the changed ID structure
 introduced in the fix for
 [#61014](https://core.trac.wordpress.org/ticket/61014), causing the
 syncing issue between the two category tabs.

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


More information about the wp-trac mailing list