{"id":4380,"date":"2019-02-23T00:24:53","date_gmt":"2019-02-22T15:24:53","guid":{"rendered":"http:\/\/haakondahl.com\/blog\/?p=4380"},"modified":"2019-02-23T00:24:53","modified_gmt":"2019-02-22T15:24:53","slug":"un-spamming-wordpress","status":"publish","type":"post","link":"https:\/\/balldiamondball.com\/blog\/un-spamming-wordpress\/","title":{"rendered":"Un-Spamming WordPress"},"content":{"rendered":"\n\nSomething old, and something new.\n\n\n\n\n\nFirst the new thing, which like many new things is trivial.\u00a0 This blog currently has 3,664 comments, all but perhaps 100 are guaranteed to be spam.\u00a0 Well I had put up a &#8220;sticky&#8221; post some months ago, which means that it stays at the top of the blog no matter what.\u00a0 Guess what?\u00a0 Of the 3,664 posts, 3,231 of them are attached to the sticky post.\u00a0 A-ha.\u00a0 Most of these spam-bots simply attack the first post listed on the blog.\u00a0 So new anti-spam measure #1: create a spam magnet post and make it sticky.\u00a0 Tell people not to comment on this post.\u00a0 Periodically, dump all of the comments.\n\nThe old thing is profound.\u00a0 Obvious, but profound.\u00a0 WordPress is not the friendliest environment in which to make bulk changes.\u00a0 This can be an issue when you need to target large numbers of obviously spam comments while protecting those few worthy comments form, you know, human beings.\u00a0 So, using a statistical trick and a bit of laziness, you can wipe out vast tracts of weeds while preserving the wheat.\u00a0 Look at the comments in reverse chronological order, which is the default.\u00a0 The first comment that you see is the most recently posted.\u00a0 Let us assume that the time and date a comment was posted have nothing to do with whether it is spam or not.\n\nGlance at the comment to ensure it is spam, and believe me, most of the time, a glance is all it will take.\u00a0 Spam senders are diverse &#8212; some send a lot and some send just a little.\u00a0 Some send in bursts, while others send slow-Loris-like, trickling slowly but consistently to generate huge numbers regardless.\u00a0 Still, the numbers will tell, and the lw of large numbers means that this tip works particularly well *just when you need it*.\n\nFind the first spam comment.\u00a0 Note its sender address.\u00a0 Search your comments (using the search function for @baddomain.com, and when those results pop up, hit select all.\u00a0 Then delete.\u00a0 You&#8217;ll want to se the number of results to the maximum, 250 at last report.\u00a0 You may only get seven, or three, or one on your first try.\u00a0 But just by taking each spam comment in turn and then searching for similar senders, you will eliminate larger numbers sooner than smaller numbers.\u00a0 Why?\u00a0 Because at any point in the sequence of comments, you are more likely to run across a comment sent from a prolific sender than a more &#8212; shall we say &#8212; discerning spam sender.\u00a0 You could go about in any order you like or none at all and statistically, the results would be the same.\u00a0 No matter what you do, you will hit the worstest the firstest.\u00a0 But the simplest thing to do, the one which takes the least work, is to simply accept the reverse chronological default listing and plod away at that.\n\nWhy is this such good news?\u00a0 Because when you&#8217;re smart, you make things hard.\u00a0 God knows I do, and I&#8217;m so smart that my shirt is inside out.\u00a0 It&#8217;s easy to get wrapped up in a workflow of extracting counts by sender of spam comments, and then ranking by count, and then re-attacking once you have this highly valuable information.\u00a0 You then proceed with an accurate list of the most prolific spam commenters, and you know that your list will eliminate the greatest amount of spam comments in the shortest amount of time, because you have them sorted on order count, descending.\n\nBut there&#8217;s a price to pay, and it is two0fold.\u00a0 First, you;ve spent some amount of time and effort to generate that list.\u00a0 I say that the effort to do that is *not* repaid by the slight increase in performance you *might* see as opposed to just going down the list and searching on each bad guy you find, letting the Law of Large Numbers do the heavy lifting.\u00a0 Second, once you expend a great deal of effort on proving your intellect to yourself, you are *less* likely to follow through with the monkey work of searching and deleting, and less likely to finish what you might start.\n\nIn order to generate some data, I went ahead and did the search thing for a while, until I ran out of lines on my pocket Moleskine.\u00a0 Seemed like a fair enough &#8220;nothing up my sleeve&#8221; stopping point.\u00a0 But I&#8217;m about to go whack everything on the sticky post and edit it to apologize for any worthwhile comments that I may have deleted.\n\nHere are some numbers for the curious:\n<table style=\"border-collapse: collapse; width: 240pt;\" border=\"0\" width=\"320\" cellspacing=\"0\" cellpadding=\"0\"><colgroup> <col style=\"width: 48pt;\" span=\"5\" width=\"64\" \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt; width: 48pt;\" width=\"64\" height=\"20\">(A)Rev Chronological First Found<\/td>\n<td style=\"width: 48pt;\" width=\"64\">(B)Domain<\/td>\n<td style=\"width: 48pt;\" width=\"64\">(C)Count in 131<\/td>\n<td style=\"width: 48pt;\" width=\"64\">(D)Projected Total = (C)*(3,661\/131)<\/td>\n<td style=\"width: 48pt;\" width=\"64\">(E)Actual Total<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">1<\/td>\n<td>gmail.com<\/td>\n<td align=\"right\">63<\/td>\n<td align=\"right\">1762.1<\/td>\n<td align=\"right\">618<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">2<\/td>\n<td>mail.ru<\/td>\n<td align=\"right\">87<\/td>\n<td align=\"right\">2433.3<\/td>\n<td align=\"right\">1845<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">3<\/td>\n<td>popcas.ru<\/td>\n<td align=\"right\">1<\/td>\n<td align=\"right\">18<\/td>\n<td align=\"right\">1<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">13<\/td>\n<td>xmmail.ru<\/td>\n<td align=\"right\">8<\/td>\n<td align=\"right\">223.76<\/td>\n<td align=\"right\">60<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">18<\/td>\n<td>topazpro.xyz<\/td>\n<td align=\"right\">1<\/td>\n<td align=\"right\">18<\/td>\n<td align=\"right\">4<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">19<\/td>\n<td>yandex.ru<\/td>\n<td align=\"right\">5<\/td>\n<td align=\"right\">139.85<\/td>\n<td align=\"right\">37<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">21<\/td>\n<td>koreamail.com<\/td>\n<td align=\"right\">3<\/td>\n<td align=\"right\">83.908<\/td>\n<td align=\"right\">3<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">22<\/td>\n<td>spacecas.ru<\/td>\n<td align=\"right\">4<\/td>\n<td align=\"right\">111.88<\/td>\n<td align=\"right\">24<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">28<\/td>\n<td>urx7.com<\/td>\n<td align=\"right\">1<\/td>\n<td align=\"right\">18<\/td>\n<td align=\"right\">1<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">36<\/td>\n<td>bigmir.net<\/td>\n<td align=\"right\">5<\/td>\n<td align=\"right\">139.85<\/td>\n<td align=\"right\">14<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">51<\/td>\n<td>glmux.com<\/td>\n<td align=\"right\">1<\/td>\n<td align=\"right\">18<\/td>\n<td align=\"right\">6<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">63<\/td>\n<td>counsellor.com<\/td>\n<td align=\"right\">1<\/td>\n<td align=\"right\">18<\/td>\n<td align=\"right\">1<\/td>\n<\/tr>\n<tr style=\"height: 15.0pt;\">\n<td style=\"height: 15.0pt;\" align=\"right\" height=\"20\">71<\/td>\n<td>priest.com<\/td>\n<td align=\"right\">2<\/td>\n<td align=\"right\">55.939<\/td>\n<td align=\"right\">2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\nAnd a picture of the correlation:\n\n<a href=\"https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-4386\" src=\"https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation.png\" alt=\"\" width=\"809\" height=\"714\" srcset=\"https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation.png 809w, https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation-300x265.png 300w, https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation-150x132.png 150w, https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation-768x678.png 768w, https:\/\/balldiamondball.com\/blog\/wp-content\/uploads\/2019\/02\/correlation-170x150.png 170w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a>\n\n<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"https:\/\/balldiamondball.com\/blog\/wp-login.php\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"4380\" data-trigger-type=\"like\" data-restriction=\"user\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"https:\/\/balldiamondball.com\/blog\/wp-login.php\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"4380\" data-trigger-type=\"dislike\" data-restriction=\"user\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-down\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Something old, and something new. First the new thing, which like many new things is trivial.\u00a0 This blog currently has 3,664 comments, all but perhaps 100 are guaranteed to be spam.\u00a0 Well I had put up a &#8220;sticky&#8221; post some months ago, which means that it stays at the top of the blog no matter what.\u00a0 Guess what?\u00a0 Of the 3,664 posts, 3,231 of them are attached to the sticky post.\u00a0 A-ha.\u00a0 Most of these spam-bots simply attack the first post listed on the blog.\u00a0 So new anti-spam measure #1: create a spam magnet post and make it sticky.\u00a0 Tell people not to comment on this post.\u00a0 Periodically, dump all of the comments. The old thing is profound.\u00a0 Obvious, but profound.\u00a0 WordPress is not the friendliest environment in &#8230; <a href=\"https:\/\/balldiamondball.com\/blog\/un-spamming-wordpress\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":34128,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4380","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/posts\/4380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/users\/34128"}],"replies":[{"embeddable":true,"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/comments?post=4380"}],"version-history":[{"count":0,"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/posts\/4380\/revisions"}],"wp:attachment":[{"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/media?parent=4380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/categories?post=4380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/balldiamondball.com\/blog\/wp-json\/wp\/v2\/tags?post=4380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}