You can manually adjust this number using the following method.
function adjust_wp_comments_count( $original_counts ) {
$counts = new \stdClass();
$counts->moderated = 99;
return $counts;
}
add_filter( 'wp_count_comments', 'adjust_wp_comments_count', 100, 1 );
The line: $counts->moderated = 99
is what you will need to adjust if you want to set it to a particular value or calculation of your choosing.
Note: I’ve set the filter priority to 100 as I found other plugins also affect this. It depends on your setup. If you add this filter and it doesn’t work, change 100
to 100000
or any other large number. The higher the number, the more likely that your modifications will take effect.
WordPress also dynamically changes the comment counts on-the-fly as you change comment status in the Edit Comments page. This code doesn’t take any of that into consideration. It simply provides you a mechanism to set the number as it’s displayed when the page loads.
Note: Forcefully setting this value may have unintended consequences elsewhere in the system. Test and evaluate for your particular circumstances.