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.

/** * Don't display low share counts * * @author Bill Erickson * @link 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 );

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk