ap_delete_post_vote( integer $post_id, boolean|integer $user_id = false, boolean|string $up_vote = null )

Description #

Delete post vote and update qameta votes count.

Parameters #

  • $post_id
    integer (Required) Post ID.
  • $user_id
    boolean | integer (Optional) User ID. Default value: false
  • $up_vote
    boolean | string (Optional) Is up vote. Default value: null

Source #

File: includes/votes.php

function ap_delete_post_vote( $post_id, $user_id = false, $up_vote = null ) {
	$value = false;

	if ( null !== $up_vote ) {
		$value = $up_vote ? '1' : '-1';
	}

	$type = $up_vote ? 'vote_up' : 'vote_down';
	$rows = ap_delete_vote( $post_id, $user_id, 'vote', $value );

	if ( false !== $rows ) {
		$counts = ap_update_votes_count( $post_id );
		do_action( 'ap_undo_vote', $post_id, $counts );
		do_action( 'ap_undo_' . $type, $post_id, $counts );

		return $counts;
	}
	return false;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment