Make WordPress Core

Ticket #11302: 11302.diff

File 11302.diff, 1.9 KB (added by pbiron, 5 months ago)

a fix for the same root cause identified in https://core.trac.wordpress.org/ticket/11302#comment:88, but in a more direct way

  • src/js/_enqueues/admin/inline-edit-post.js

    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 b window.wp = window.wp || {}; 
    180180                var te = '', type = this.type, c = true;
    181181                var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
    182182                var categories = {};
    183                 var indeterminatePostCategoryField = $( '<input type="hidden" name="indeterminate_post_category[]">' );
    184183                this.revert();
    185184
    186185                $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
    window.wp = window.wp || {}; 
    234233
    235234                // Compute initial states.
    236235                $( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
    237                         // Clear indeterminate states.
    238                         $( '<input type="hidden" name="indeterminate_post_category[]">' ).remove();
    239 
    240236                        if ( categories[ $( this ).val() ] == checkedPosts.length ) {
    241237                                // If the number of checked categories matches the number of selected posts, then all posts are in this category.
    242238                                $( this ).prop( 'checked', true );
    window.wp = window.wp || {}; 
    245241                                $( this ).prop( 'indeterminate', true );
    246242
    247243                                // Set indeterminate states for the backend.
    248                                 indeterminatePostCategoryField.val( $( this ).val() );
    249                                 $( this ).after( indeterminatePostCategoryField );
     244                                $( this ).after( '<input type="hidden" name="indeterminate_post_category[] value="' + $( this ).val() + '"'>' );
    250245                        }
    251246                } );
    252247