WordPress.org

Make WordPress Core

Changeset 37664


Ignore:
Timestamp:
06/09/2016 02:21:27 AM (4 years ago)
Author:
rachelbaker
Message:

Comments: Fix pagination totals in the response of the inline delete actions when filtering the List Table by comment_type.

Within the Ajax action _wp_ajax_delete_comment_response() if the comment_type query var is set, fallback to the previous $total - 1 value instead of getting an incorrect value from wp_comment_count().

Fixes #36991.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r37584 r37664  
    396396            if ( !empty( $query_vars['p'] ) )
    397397                $post_id = (int) $query_vars['p'];
    398         }
    399 
    400         $comment_count = wp_count_comments($post_id);
    401 
    402         // We're looking for a known type of comment count.
    403         if ( isset( $comment_count->$status ) )
    404             $total = $comment_count->$status;
    405             // Else use the decremented value from above.
     398            if ( ! empty( $query_vars['comment_type'] ) )
     399                $type = $query_vars['comment_type'];
     400        }
     401
     402        if ( empty( $type ) ) {
     403            // Only use the comment count if not filtering by a comment_type.
     404            $comment_count = wp_count_comments($post_id);
     405
     406            // We're looking for a known type of comment count.
     407            if ( isset( $comment_count->$status ) ) {
     408                $total = $comment_count->$status;
     409            }
     410        }
     411        // Else use the decremented value from above.
    406412    }
    407413
Note: See TracChangeset for help on using the changeset viewer.