From 3df098e2d0d8a44db4c6435af5e74b90cc304647 Mon Sep 17 00:00:00 2001 From: im3dabasia Date: Fri, 15 Nov 2024 18:53:57 +0530 Subject: [PATCH 1/2] fix: Sync issue between "Most Used" and "All Categories" tabs in Classic Editor Fixes issue #62440 on trac --- src/js/_enqueues/admin/post.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/post.js b/src/js/_enqueues/admin/post.js index 5dd70b950fb72..76a05e1a851b8 100644 --- a/src/js/_enqueues/admin/post.js +++ b/src/js/_enqueues/admin/post.js @@ -659,8 +659,10 @@ jQuery( function($) { '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 ); + if ( id && t.parents('#taxonomy-'+taxonomy).length ) { + $('#in-' + taxonomy + '-' + id + ', [id^="in-' + taxonomy + '-' + id + '-"]').prop('checked', c); + $('#in-popular-' + taxonomy + '-' + id).prop('checked', c); + } } ); From 87a67fe0cc0d544e42e9203fadfc6de323f65848 Mon Sep 17 00:00:00 2001 From: Andrew Ozz <743931+azaozz@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:07:36 -0800 Subject: [PATCH 2/2] Limit to input elements, shorten --- src/js/_enqueues/admin/post.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/post.js b/src/js/_enqueues/admin/post.js index 76a05e1a851b8..95c2fa0400fe7 100644 --- a/src/js/_enqueues/admin/post.js +++ b/src/js/_enqueues/admin/post.js @@ -660,8 +660,8 @@ jQuery( function($) { function() { var t = $(this), c = t.is(':checked'), id = t.val(); if ( id && t.parents('#taxonomy-'+taxonomy).length ) { - $('#in-' + taxonomy + '-' + id + ', [id^="in-' + taxonomy + '-' + id + '-"]').prop('checked', c); - $('#in-popular-' + taxonomy + '-' + id).prop('checked', c); + $('input[id^="in-' + taxonomy + '-' + id + '"]').prop('checked', c); + $('input#in-popular-' + taxonomy + '-' + id).prop('checked', c); } } );