action
Fires after a like is successfully added.
Parameters of davo_like_added Parameter Type Description $user_id int The user who liked. $target_id int The liked target ID. $target_type string Target type slug ('post', 'video', 'comment', etc.). $object_type string 'post_type' or 'comment'. $new_count int Total likes after this action.
add_action Copyadd_action ( 'davo_like_added' , 'my_action_callback' , 10 , 5 );
/**
* @param int $user_id
* @param int $target_id
* @param string $target_type
* @param string $object_type
* @param int $new_count
*/
function my_action_callback ( $user_id , $target_id , $target_type , $object_type , $new_count ) {
// Your code here.
}src/domains/likes/repository.php:389
action
Fires after a like is successfully removed.
Parameters of davo_like_removed Parameter Type Description $user_id int The user who unliked. $target_id int The unliked target ID. $target_type string Target type slug ('post', 'video', 'comment', etc.). $object_type string 'post_type' or 'comment'. $new_count int Total likes after this action.
add_action Copyadd_action ( 'davo_like_removed' , 'my_action_callback' , 10 , 5 );
/**
* @param int $user_id
* @param int $target_id
* @param string $target_type
* @param string $object_type
* @param int $new_count
*/
function my_action_callback ( $user_id , $target_id , $target_type , $object_type , $new_count ) {
// Your code here.
}src/domains/likes/repository.php:470
filter
Filters the trending score decay value. Increase the exponent to penalise older posts more aggressively.
Parameters of davo_like_trending_decay Parameter Type Description $decay float Computed decay divisor. $target_id int Post ID. $target_type string Post type slug.
add_filter Copyadd_filter ( 'davo_like_trending_decay' , 'my_filter_callback' , 10 , 3 );
/**
* @param float $decay
* @param int $target_id
* @param string $target_type
*/
function my_filter_callback ( $decay , $target_id , $target_type ) {
// Change $decay as needed, then return it.
return $decay ;
}src/domains/likes/repository.php:533
filter
Filters the final trending score before it is stored.
Parameters of davo_like_trending_score Parameter Type Description $score float Computed score. $target_id int Post ID. $target_type string Post type slug. $count int Current like count.
add_filter Copyadd_filter ( 'davo_like_trending_score' , 'my_filter_callback' , 10 , 4 );
/**
* @param float $score
* @param int $target_id
* @param string $target_type
* @param int $count
*/
function my_filter_callback ( $score , $target_id , $target_type , $count ) {
// Change $score as needed, then return it.
return $score ;
}src/domains/likes/repository.php:545
filter
Filters the most-liked results before they are cached and returned.
Parameters of davo_likes_most_liked Parameter Type Description $result list<array<string, mixed>> The computed results. $target_type string Post type slug. $count int Requested result count. $period int Rolling window in days.
add_filter Copyadd_filter ( 'davo_likes_most_liked' , 'my_filter_callback' , 10 , 4 );
/**
* @param list<array<string, mixed>> $result
* @param string $target_type
* @param int $count
* @param int $period
*/
function my_filter_callback ( $result , $target_type , $count , $period ) {
// Change $result as needed, then return it.
return $result ;
}src/domains/likes/repository.php:211
filter
Filters how many records each run of the like-count resync handles. Defaults to 200.
Parameters of davo_likes_resync_batch_size Parameter Type Description $size int Batch size.
Returns int
add_filter Copyadd_filter ( 'davo_likes_resync_batch_size' , 'my_filter_callback' , 10 , 1 );
/**
* @param int $size
*/
function my_filter_callback ( $size ) {
// Change $size as needed, then return it.
return $size ;
}src/domains/likes/crons/resync.php:103
action
Fires after a resync cron run completes.
Parameters of davo_likes_resync_complete Parameter Type Description $resynced int Number of distinct targets resynced this run.
add_action Copyadd_action ( 'davo_likes_resync_complete' , 'my_action_callback' , 10 , 1 );
/**
* @param int $resynced
*/
function my_action_callback ( $resynced ) {
// Your code here.
}src/domains/likes/crons/resync.php:121
filter
Filters the target types that support likes.
Parameters of davo_likes_target_types Parameter Type Description $target_types string[] Array of target-type slugs (post types + 'comment').
add_filter Copyadd_filter ( 'davo_likes_target_types' , 'my_filter_callback' , 10 , 1 );
/**
* @param string[] $target_types
*/
function my_filter_callback ( $target_types ) {
// Change $target_types as needed, then return it.
return $target_types ;
}src/domains/likes/helpers.php:71
filter
Filters the trending results before they are cached and returned.
Parameters of davo_likes_trending Parameter Type Description $result list<array<string, mixed>> The computed results. $target_type string Post type slug. $count int Requested result count.
add_filter Copyadd_filter ( 'davo_likes_trending' , 'my_filter_callback' , 10 , 3 );
/**
* @param list<array<string, mixed>> $result
* @param string $target_type
* @param int $count
*/
function my_filter_callback ( $result , $target_type , $count ) {
// Change $result as needed, then return it.
return $result ;
}src/domains/likes/repository.php:333