Skip to content

Commit

Permalink
New filter tptn_before_update_count
Browse files Browse the repository at this point in the history
Use the filter to check if the counts should be updated in the database or ignored.
  • Loading branch information
ajaydsouza committed Jan 26, 2024
1 parent 7c80667 commit 89d2e81
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion includes/class-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,19 @@ public static function update_count( $id, $blog_id, $activate_counter ) {
$table_name_daily = Helpers::get_tptn_table( true );
$str = '';

if ( $id > 0 ) {
/**
* Filter the flag to confirm that counts should be updated in the database.
*
* @since 3.4.0
*
* @param bool $flag Flag to confirm that counts should be updated in the database.
* @param int $id Post ID.
* @param int $blog_id Blog ID.
* @param int $activate_counter Activate counter flag.
*/
$before_update_count = apply_filters( 'tptn_before_update_count', true, $id, $blog_id, $activate_counter );

if ( $id > 0 && $before_update_count ) {

if ( ( 1 === $activate_counter ) || ( 11 === $activate_counter ) ) {

Expand Down

0 comments on commit 89d2e81

Please sign in to comment.