$wpdb->delete column values IN ARRAY()?

I am wondering if this is possible?

$wpdb->delete(
    'table_name',
    array('id' => array(1, 2, 3)),
    array('%d')
);

So, in this situation, it should remove 3 rows at once, and call the database only 1 time. I have a lot of deletions that could be possible with my script and would rather it just perform the deletion once, instead of having to loop through all of the ids and do a $wpdb->delete on each one individually. Is this possible? Seems like it should be…

Related posts

Leave a Reply

1 comment

  1. as i see if your method dont work you can replace it with this one :

    $idList = array('1','2','3','4','5');
    $idListString = implode(",",$idList);
    $wpdb->query("DELETE FROM this_table WHERE id IN ($idListString)");
    

    but let me know if it works thanks