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.

git-svn-id: https://develop.svn.wordpress.org/trunk@37664 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Rachel Baker 2016-06-09 02:21:27 +00:00
parent 0c990ffb73
commit 8910870205
1 changed files with 11 additions and 5 deletions

View File

@ -395,14 +395,20 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
$status = $query_vars['comment_status'];
if ( !empty( $query_vars['p'] ) )
$post_id = (int) $query_vars['p'];
if ( ! empty( $query_vars['comment_type'] ) )
$type = $query_vars['comment_type'];
}
$comment_count = wp_count_comments($post_id);
if ( empty( $type ) ) {
// Only use the comment count if not filtering by a comment_type.
$comment_count = wp_count_comments($post_id);
// We're looking for a known type of comment count.
if ( isset( $comment_count->$status ) )
$total = $comment_count->$status;
// Else use the decremented value from above.
// We're looking for a known type of comment count.
if ( isset( $comment_count->$status ) ) {
$total = $comment_count->$status;
}
}
// Else use the decremented value from above.
}
// The time since the last comment count.