Skip to content

Instantly share code, notes, and snippets.

@pmgarman
Last active April 13, 2023 16:48
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pmgarman/d64c768754dbc0ff5f49 to your computer and use it in GitHub Desktop.
Save pmgarman/d64c768754dbc0ff5f49 to your computer and use it in GitHub Desktop.
<?php
/*
* Plugin Name: Remove crazy counts slowing down my dashboard
* Plugin URI: https://pmgarman.me
* Description: Those comment counts are such a pain when you have a lot of comments
* Author: Patrick Garman
* Author URI: https://pmgarman.me
* Version: 1.0.0
* License: GPLv2
*/
// Remove unmoderated comment counts from the admin menu
function pmgarman_unmoderated_comment_counts( $stats, $post_id ) {
global $wpdb;
if ( 0 === $post_id ) {
$stats = json_decode( json_encode( array(
'moderated' => 0,
'approved' => 0,
'post-trashed' => 0,
'trash' => 0,
'total_comments' => 0
) ) );
}
return $stats;
}
add_filter( 'wp_count_comments', 'pmgarman_unmoderated_comment_counts', 10, 2 );
// If running WooCommerce, remove their filter so that nothing funky goes down
remove_filter( 'wp_count_comments', array( 'WC_Comments', 'wp_count_comments' ), 10 );
// Remove order count from admin menu
add_filter( 'woocommerce_include_processing_order_count_in_menu', '__return_false' );
@tnorthcutt
Copy link

add_filter( 'woocommerce_include_order_count_in_menu', '__return_false' );

---->

add_filter( 'woocommerce_include_processing_order_count_in_menu', '__return_false' );

@pmgarman
Copy link
Author

pmgarman commented Oct 5, 2016

@tnorthcutt finally pulled in your change :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment