Recently one of the posts on Inficone got a huge amount of pingbacks from the web. Note that by default I had enabled both comments and pingbacks on this very post. As the pingbacks rose in to thousands, it became very difficult to manage them. Most of these pingbacks were from irrelevant sites and amounted to spam. So I decided to delete these pingbacks from the wordpress dashboard. However I soon ran out of steam as wordpress dashboard allowed me only 20 deletions at a time from the comments panel. So I soon realized this is not leading me anywhere. The comments status looked something like the following.
To look for the solution, I focused on the file which is responsible for displaying the comments in the wordpress dashboard. If you hover over the comments clickable item in the left vertical bar of your wordpress dashboard, the link is displayed in the bottom of the browser bar as given below( notice at the bottom of the snapshot). This indicates that the output is provided through wp-admin/edit-comments.php.
In this file, a single line change solved the problem which looked pretty intuitive as well. I just changed
$comments_per_page = 20;
$comments_per_page = 2000;
I chose 2000 as my pending comments ran in to around 1900 as seen in the snapshot above. After making this change and saving; when I refreshed the comments tab, I could see all the pending comments on a single page. I could then use the comment filter to choose only pingbacks. Once all the pingbacks got listed, I could easily delete it using the bulk delete option ( which earlier was just working for 20 comments in one go ).
Unfortunately, there was still a problem. When I chose the bulk option of <Move to Trash>, I got the following message.
This URI too large error is essentially an HTTP return code which is output by the server if it cannot handle the URL length. In this case, the length of the URL seems to be dependent on the number of comments being deleted in one go. After some hit and try, I could figure out that a bulk delete with a value of 200 was working fine and 300 was still giving the same error as above. So the final change done was to make the value as 200 as indicated below.
$comments_per_page = 200;
With the above change, it took around 10 iterations (200x10 = 2000 which is greater then the number of comments that I wanted to delete ). This was still 10 times faster then what I was trying earlier though!!. Once the deletion was done, I reverted the above change to restore the default wordpress setting of 20 comments.
If you are also facing similar problem, do try this solution and let us know your feedback in the comments section. If you liked the post, do share it with your friends. You can always submit any useful tools, tips and web services to us.