From 6f2676296a5f973e99bfbf64369d073e7a8a4a05 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Wed, 8 Nov 2023 17:20:24 -0700
Subject: [PATCH] Fix 11302 in a different way than was done in r56712, which
 was revered in r57094 because it introduced a bug.

---
 src/js/_enqueues/admin/inline-edit-post.js | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/js/_enqueues/admin/inline-edit-post.js b/src/js/_enqueues/admin/inline-edit-post.js
index 1f572353ff..cb7a8c3f6f 100644
--- a/src/js/_enqueues/admin/inline-edit-post.js
+++ b/src/js/_enqueues/admin/inline-edit-post.js
@@ -180,7 +180,6 @@ window.wp = window.wp || {};
 		var te = '', type = this.type, c = true;
 		var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
 		var categories = {};
-		var indeterminatePostCategoryField = $( '<input type="hidden" name="indeterminate_post_category[]">' );
 		this.revert();
 
 		$( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
@@ -234,9 +233,6 @@ window.wp = window.wp || {};
 
 		// Compute initial states.
 		$( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
-			// Clear indeterminate states.
-			$( '<input type="hidden" name="indeterminate_post_category[]">' ).remove();
-
 			if ( categories[ $( this ).val() ] == checkedPosts.length ) {
 				// If the number of checked categories matches the number of selected posts, then all posts are in this category.
 				$( this ).prop( 'checked', true );
@@ -245,8 +241,7 @@ window.wp = window.wp || {};
 				$( this ).prop( 'indeterminate', true );
 
 				// Set indeterminate states for the backend.
-				indeterminatePostCategoryField.val( $( this ).val() );
-				$( this ).after( indeterminatePostCategoryField );
+				$( this ).after( '<input type="hidden" name="indeterminate_post_category[] value="' + $( this ).val() + '"'>' );
 			}
 		} );
 
-- 
2.39.1.windows.1

