ap_delete_vote( integer $post_id, integer|boolean $user_id = false, string|array $type = 'vote', string $value = false )
Description #
Delete vote from database.
Parameters #
- $post_idinteger (Required) Post ID.
- $user_idinteger | boolean (Optional) User ID. Default value: false
- $typestring | array (Optional) Vote type. Default value: 'vote'
- $valuestring (Optional) Vote value. Default value: false
Source #
File: includes/votes.php
function ap_delete_vote( $post_id, $user_id = false, $type = 'vote', $value = false ) { global $wpdb; if ( false === $user_id ) { $user_id = get_current_user_id(); } $where = array( 'vote_post_id' => $post_id, 'vote_user_id' => $user_id, 'vote_type' => $type, ); if ( false !== $value ) { $where['vote_value'] = $value; } $row = $wpdb->delete( $wpdb->ap_votes, $where ); // phpcs:ignore WordPress.DB if ( false !== $row ) { do_action( 'ap_delete_vote', $post_id, $user_id, $type, $value ); } return $row; }
Expand full source code Collapse full source code View on GitHub: includes/votes.php:488
Add your comment