Software Guide

Die besten Tipps, Anleitungen und Downloads

Ihre Werbung auf Software Guide

Sie möchten in dieser Box oder an anderer Stelle dieser Webseiten eine Werbung schalten? Sehen Sie sich dazu am besten einfach mal die verschiedenen Möglichkeiten an.

Math Comment Spam Protection Plugin

SpamThis plugin for WordPress 2.9 and 3.0+ asks the visitor making the comment to answer a simple math question. This is intended to prove that the visitor is a human being and not a spam robot.

Example of such question:
Example of spam protection question

This plugin does not require JavaScript or cookies. It uses a special encryption function; the result of the question is being passed via a hidden field. The result is being compared with the value entered by the visitor – after encrypring this value as well.



This plugin can be installed in 4 easy steps:

  1. Download the plugin (see „Downloads“ above), decompress the .zip archive and put the files into your plugins directory (/wp-content/plugins/) or into a sub directory of the plugins directory.
  2. Enable the plugin in the WordPress Plugins admin page.
  3. Go to Options > Math Comment Spam, adjust the options and save.
  4. Adding the HTML code to your theme by using way a, b, or c:
    1. The new field for the math question will be added automatically when the option ‚Add math question field automatically‘ is activated. This works well for the standard WordPress 3 theme (Twenty Ten), but may not work for some other (and older) themes. In this case use way b or c.
    2. If ‚Add math question field automatically‘ does not work for your theme, you can also deactivate this option and add the following code to the comments.php of your theme for example right after the field for the website URL:
      <?php if ( function_exists('mcsp_html') )  mcsp_html(); ?>

      mcsp_html()will output the HTML code from the plugin option ‚HTML code for the math question field‘.

    3. Furthermore, you can also add the HTML code directly to your comments.php by using for example the following code:
      <?php if ( function_exists('math_comment_spam_protection') ) {
      $mcsp_info = math_comment_spam_protection();
      ?> <p><input type="text" name="<?php echo $mcsp_info['fieldname_answer'] ?>" id="<?php echo $mcsp_info['fieldname_answer'] ?>" value="" size="22" tabindex="4" />
      <label for="<?php echo $mcsp_info['fieldname_answer'] ?>">Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></label>
      <input type="hidden" name="<?php echo $mcsp_info['fieldname_hash'] ?>" value="<?php echo $mcsp_info['result']; ?>" />
      <?php } // if function_exists... ?>

Frequently Asked Questions

  1. Question: I’ve installed this plugin but still get spammed, why?
    Answer: Are you sure that you get comment spam, isn’t it trackback spam? In case of trackback spam consider installing a plugin like Simple Trackback Validation Plugin.

Other Plugins for Spam Protection

I recommend to use the following 3 plugins for protecting your weblog from spam:

  • Simple Trackback Validation Plugin: Eliminates spam trackbacks by retrieving the web page located at the URL used in the trackback and checking if the page contains a link to your blog: if not, the trackback is placed into comment moderation queue.
  • Math Comment Spam Protection (this plugin)
  • Akismet: additional protection in case of attacks by human spammers or trackback spammers that use the permalink on the web page located at the trackback’s URL.

Related Plugins

I got the idea for this plugin from Steven Herod’s plugin Did You Pass Math?. However, the code of the Math Comment Spam Protection Plugin is completely differently. While Did You Pass Math? provides a one-click-installation which works for standard themes only, my plugin requires you to place the form in the comments.php on your own. But this has one big advantage: You can add the field whereever you want and JavaScript is not needed for positioning it. So you can use this plugin in every theme. Furthermore, it is not necessary that the visitor has enabled cookies in his/her browser. In addition, I have seen that when using the Did You Pass Math plugin and if you entered a wrong or no answer and press the back button in your browser, the comment is no more available! This is not the case when using the Math Comment Spam Protection Plugin.
Any ways: if you are afraid of modifying the source code of your theme, I recommend that you go for the Did You Pass Math? plugin.


Do you like my work? Any donation would be highly appreciated.

Wish List

Version History and Changelog


Support: I don’t have the time to support you on the implementation and usage of this plugin. Also the comments at this page have been turned off for this reason. However a donation may help to change my mind and support you anyway :)

How to Report a Bug: Before you report a bug, please make sure you have double-checked that you have followed the above installation instructions correctly.
Please send me your bug report by e-mail.
Bug reports are highly appreciated and will help for the continuous improvement of this plugin, however I can’t promise to get back to you in time regarding your reported bug.



Neueste Artikel

Neueste Kommentare

Neueste Trackbacks/Pingbacks

Andere Projekte


dient als zentrale Anlaufstelle für Blog-Paraden bzw. Blog-Karnevals und andere von BloggerInnen veranstaltete Aktionen.



Software Guide gibt es seit Dezember 2005 und es werden durchschnittlich 2 Blog- Beiträge/Monat veröffentlicht. Die Themenschwerpunkte sind in der Tagcloud ersichtlich. Mehr Infos...



Nach oben


© 2005-2024 Software Guide | ISSN 1864-9599