I have this code
add_action( 'delete_post', 'my_delete_function' );
function my_delete_function() {
global $wpdb;
$wpdb->query("
DELETE FROM wp_votes WHERE post=".$thePostID."
;);
}
How can I get the id of the post being deleted?
Additionally, will this still work if multiple posts are deleted in the admin?
The hooks automatically pass the deleted post id into your function, so you can just catch that, check the docs here: