gdrts_calculate_emote_this_item

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

This filter (gdrts_calculate_emote_this_item) is used to filter item after the vote calculations have been done after voting.

This filter provides 4 arguments. Using this filter allows modifications to the $item and even modification of the calculated ratings. Do not use if you are not sure what this can do.

Arguments

  • $item: item used to do calculations for.
  • $action: action can be vote or revote.
  • $vote: vote added to the calculation.
  • $previous: if $action is a revote, this is the vote being replaced.

Example

add_filter('gdrts_calculate_emote_this_item', 'custom__gdrts_calculate_emote_this_item', 10, 4);
function custom__gdrts_calculate_emote_this_item($item, $action, $vote, $previous) {
  // modify the $item object //

  // return the $item object//
  return $item;
}
1
0
905
Rate this reference

You are not allowed to rate this post.

Leave a Comment