« How to remove the beep sound from Firefox Search | Main | Presently: Powerpoint-light from Google »
My first comment spam! (and how to change WordPress to avoid it)
By maurizio | April 17, 2007
And the second is already here! Wow..
The first one is coming from cox.net : ip70-180-188-65.lv.lv.cox.net, the second one from netlinx: 202.53.95.210.nettlinx.com.
I think I’ll leave them there but I will remove any links.
I changed a bit my blog to avoid this will happen again. It’s the usual trick with wp-comments-post.php and wp-trackback.php.
You simply have to rename those two file, for example “wp-comments-post-nafurai.php”. Do the same with wp-trackback.php.
Next step is to find all the file that were linking to it.
I usually do all this on a shell, without downloading it all and wasting time. The easiest way to find the file to modify is to use “rgrep”
rgrep wp-comments-post.php *
This command is called “recursive grep” (some webhosting companies doesn’t have it, so you should use “grep -r” instead) and it’s job is to find text inside files. The command is easy to understand; the first “thing” after the command is the pattern I am looking for. On our example we are looking for wp-comments-post.php. The second “thing” is which file it has to look in; on our case all files recursively.
For the wp-comment-post.php you should see a lot of lines if you have a lot of themes installed. Look at the lines that starts with the name of your current theme. You should change them all if you plan to change your theme often. My line started like this:
wp-content/themes/rockinblue-3col-1/comments.php:
If your theme uses a popup for comments, you should see a “/comments-popup.php” too.
If you do the same for wp-trackback.php you will see only 3 lines to change: 2 in template-loader.php and 1 in comment-template.php.
Now you can use whatever you want to change those files. I personally use vim. You can try it, just remember “:q!” is the command to exit and “:w” is the command to save what you modified. To modify just press “i” and then write; to stop modifying press ESC. To remove a character use “x”.
I’ll write about vim later if someone is interested.
Topics: Content Creation, Programming | 5 Comments »
Read other related posts:


April 28th, 2007 at 6:51 am
Hi! How r u?
nice site!
April 28th, 2007 at 4:19 pm
Peace people
We love you
May 13th, 2007 at 2:35 am
Hi My Name Is ivaylx.
May 31st, 2007 at 10:29 am
Nise site!
June 6th, 2007 at 8:00 am
Hello.
I liked your site. Very useful resource. THE BEST.
Thanks.
Sincerely,
Kina