wpDiscuz 7 API Documentation

  1. Home
  2. Docs
  3. wpDiscuz 7 API Documentation
  4. Actions
  5. wpdiscuz_add_vote
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors


This hook can be used for doing some action once the user votes for the comment first-time.


since 7.0.0 version


1. $voteType (type: int) – the type of the vote (like or dislike)
2. $comment (type: WP_Comment object) – the object of the comment


add_action("wpdiscuz_add_vote", function ($voteType, $comment) {
    if ($comment->user_id) {
        update_user_meta($comment->user_id, "user_votes", intval(get_user_meta($comment->user_id, "user_votes", true)) + $voteType);
}, 10, 2);

Was this article helpful to you? Yes No