From ed964badaebf1571f307c80f097ee9b2785c7305 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Thu, 9 Jun 2016 02:22:27 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@37664 git-svn-id: http://core.svn.wordpress.org/trunk@37630 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 16 +++++++++++----- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index f3751cb025..5ae364f01d 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index dc768bfa0e..aa01869aae 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37663'; +$wp_version = '4.6-alpha-37664'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.