Don’t display low share counts

This will hide the total share count until it is larger than the $minimum_share_count, currently set to 100.

Add this to your theme’s functions.php file or a core functionality plugin.

<?php
/**
* Dont display low share counts
*
* @author Bill Erickson
* @see https://www.billerickson.net/code/shared-counts-remove-low
*
* @param array $link
* @param int $id
* @param string $style
* @return array $link
*/
function be_shared_counts_remove_low( $link, $id, $style ) {
if( 'included_total' !== $link['type'] )
return $link;
$minimum_share_count = 100;
$count = shared_counts()->core->count( $id, 'included_total', $echo = false, $round = false );
if( $count < $minimum_share_count )
$link['count'] = 0;
return $link;
}
add_filter( 'shared_counts_link', 'be_shared_counts_remove_low', 10, 3 );
view raw functions.php hosted with ❤ by GitHub

Shared Counts