Monday, January 16, 2023
HomeWordPress Developmentwp question - Bulk delete feedback, foreach loop

wp question – Bulk delete feedback, foreach loop


I’ve a query about WordPress’s wp_delete_comment() operate.

Let’s assume I’ve an array that comprises greater than 3000 feedback ID in it and I wanna take away all of them.

First approuch could be like this:

<?php 

$comment_id_array = array(...);

foreach($comment_id_array as $comment_id){

wp_delete_comment($comment_id);

}

?>

However, I’m wondering if WordPress have queue system for that sort of operation? I imply, is WordPress making a batch take away job by ONE SQL DELETE QUERY or is WordPress executing 3000 DELETE QUERY by this operation?

If it is the second; I assume it will be higher if I’m going with a customized single delete question. As a result of 3000 question means server shutdown 🙂

Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments