kill spam comments by changing the filename wp-comments-post.php

With WordPress blogs and sites spam comments is very big issue. That waste our lot of time. There is very nice plugin called Akismet by wordpress. Which is helpful for catching the spam comments but that is not smart enough. Some spambots simply hit the wp-comments-post.php and wp-trackback.php files directly, without scanning your site to find the real names of these scripts. You can foil such bots by renaming these files. My site is also faced the spam comments and hack issues by spmmers. So following trick is very useful.

This files will not track which comment is spam. In this tutorial I will tell you about how to change the filename of wp-comments-post.php file another name. This way you can easily protect your blog against spammer comments.

You need to just follow the steps:

  1. Back up all your files.
  2. Replace all instances of wp-comments-post.php in your theme template files with wp-comments-kill-spam.php. In most themes, this will mean editing comments.php and comments-popup.php; it’s a good idea to double-check by searching through all files in your theme directory with the “find and replace” feature of your favorite editor.
  3. Upload your edited template files.
  4. Rename your wp-comments-post.php file to wp-comments-die-spam-die.php. Be sure that wp-comments-post.php is gone when you’re done, or spammers will still be able to use it!
  5. (Optional) Create a blank file and name it wp-comments-post.php. This will prevent spambots from getting a 404 error. If your 404 page is large, this will save you some bandwidth; it might also keep the spammers from catching on to your trick.
  6. Check that everything works by posting a test comment to your blog.

You will find following code in comments.php file.

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

just replace to that as follows:

<form action="<?php echo get_option('siteurl'); ?>/<tt>wp-comments-kill-spam.php</tt>" method="post" id="commentform">

This is simple way to protect your blog without any wordpress plugin. This tip is written by

If you are having any issue then please write to me

  • John

    what a great information about wordpress spam comments.

  • Earl

    Ha ha – so creative idea! lol

  • Plugpypegoory

    cool, thanks!