ap_delete_votes( integer $post_id, string $type = 'vote' )

Description #

Delete multiple post votes.

Parameters #

  • $post_id
    integer (Required) Post id.
  • $type
    string (Optional) Vote type. Default value: 'vote'

Source #

File: includes/votes.php

function ap_delete_votes( $post_id, $type = 'vote' ) {
	global $wpdb;
	$where = array(
		'vote_post_id' => $post_id,
		'vote_type'    => $type,
	);

	$rows = $wpdb->delete( $wpdb->ap_votes, $where ); // phpcs:ignore WordPress.DB

	if ( false !== $rows ) {
		do_action( 'ap_deleted_votes', $post_id, $type );
		return true;
	}

	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