Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created May 19, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/7dc6f51596bcb9aedd8fedcf58f72bf4 to your computer and use it in GitHub Desktop.
Save billerickson/7dc6f51596bcb9aedd8fedcf58f72bf4 to your computer and use it in GitHub Desktop.
<?php
/**
* Only update share counts on single post
*
* @param array $update_queue
* @return array
*/
function be_update_share_count_on_single( $update_queue ) {
if( is_singular() && !empty( $update_queue ) )
$update_queue = array_key_exists( get_queried_object_id(), $update_queue ) ? array( get_queried_object_id() => $update_queue[get_queried_object_id()] ) : array();
else
$update_queue = array();
return $update_queue;
}
add_filter( 'ea_share_count_update_queue', 'be_update_share_count_on_single' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment