2

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...

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

No it doesn't work. And yes, I'm aware of the alternatives. Thanks just the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.