Skip to content

Instantly share code, notes, and snippets.

@seedprod
Created February 6, 2024 16:01
Show Gist options
  • Save seedprod/7b3147807d10d5556d749703ebda3f8e to your computer and use it in GitHub Desktop.
Save seedprod/7b3147807d10d5556d749703ebda3f8e to your computer and use it in GitHub Desktop.
// get total entries count
$contestant_id = 1;
$tablename = $wpdb->prefix . 'rafflepress_entries';
$sql = "SELECT count(id) FROM $tablename WHERE contestant_id = %d AND deleted_at IS NULL";
$safe_sql = $wpdb->prepare( $sql, $contestant['id'] );
$total_entries = $wpdb->get_var( $safe_sql );
$contestant['total_entries'] = $total_entries;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment