Error Deleting Spam Comments
-
I am not using any spam aid (yet) with WordPress. After my MovableType import I realized I have TONS! of spam comments. I tried the “mass edit” option and I am getting the following error message, “Warning: Invalid argument supplied for foreach() in /home/binkolog/public_html/memoir/wp-admin/edit-comments.php on line 42
0 comments deleted.”
Line 38 to 52 of this file looks like this:
‘<?php _e(‘View Mode’) ?> | <?php _e(‘Mass Edit Mode’) ?>
<?php
if ( !empty( $_POST[‘delete_comments’] ) ) :
$i = 0;
foreach ($_POST[‘delete_comments’] as $comment) : // Check the permissions on each
$comment = (int) $comment;
$post_id = $wpdb->get_var(“SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment”);
$authordata = get_userdata( $wpdb->get_var(“SELECT post_author FROM $wpdb->posts WHERE ID = $post_id”) );
if ( user_can_delete_post_comments($user_ID, $post_id) ) :
$wpdb->query(“DELETE FROM $wpdb->comments WHERE comment_ID = $comment”);
++$i;
endif;
endforeach;
echo “<div class=’wrap’>” . sprintf(__(‘%s comments deleted.’), $i) . “</div>”;
endif;’Any help to fix this problem would be greatly appreciated. Thanks!
- The topic ‘Error Deleting Spam Comments’ is closed to new replies.