Math Captcha

Math Captcha is a very effective CAPTCHA for WordPress that integrates into login, registration, comments, bbPress and Contact Form 7.

Features include:

  • Select where to use math captcha: login, registration and lost password forms, comments, bbPress and Contact Form 7
  • Hiding captcha for logged in users
  • Select which mathematical operation to use
  • Displaying captcha as numbers and/or words
  • Option to set captcha field title
  • Option to set captcha input time
  • .pot file for translations included
  • 1.2.0
  • Block direct POST spam through wp-comments-post.php
  • Dynamic captcha generation using XML-RPC or AJAX
  • Bug: not working with Contact Form 7
  • Woocommerce integration
  • Add a refresh captcha button:
  • 1.0.0
  • Initial release

Leave a Reply

Your email address will not be published. Required fields are marked *

64 comments on "Math Captcha"

  1. Isn’t it possible to solve the captcha just by taking the plain numbers and solving the equation? Then, you can send the post request to the server. Maybe you could use images instead of plain text.

  2. Add extra check before setcookie ‘mc_session_ids’ plz.
    if (!isset($_COOKIE[‘mc_session_ids’][‘default’])) {
    setcookie(‘mc_session_ids[default]’, $this->session_ids[‘default’], current_time(‘timestamp’, TRUE) + apply_filters(‘math_captcha_time’, $this->options[‘general’][‘time’]), COOKIEPATH, COOKIE_DOMAIN);

    for($i = 0; $i session_ids[‘multi’][$i], current_time(‘timestamp’, TRUE) + apply_filters(‘math_captcha_time’, $this->options[‘general’][‘time’]), COOKIEPATH, COOKIE_DOMAIN);

  3. Can anyone tell me how to insert mathcaptcha? thanks.

  4. Hi Bartosz,
    I didn’t get to find in the forum or anywhere what is the code to add in custom forms such as login, comments, and so on.
    Would you post a link to the code or shortcode I should use to get to use Math Captcha within my custom login modal.


    • That is the upcoming feature – to use Math Captcha in custom forms by means of a shortcode or function.

  5. This only stops comments that are being posted from a page. If someone sends a POST request directly to wp-comments-post.php there’s no checking done for the CAPTCHA. I added this code to the top of wp-comments-post.php to drop anything that doesn’t have some value for the CAPTCHA.

    if (!isset($_POST[“mc-value”])) {
    header(“HTTP/1.1 400 Bad Request”);
    echo “Missing CAPTCHA value!”;

    • Thanks Michael. We have that in mind and try to provide a solution in the plugin (based on .htaccess probably)..

  6. it’s not working on my site .

    • Post a support topic here describe the problem and include a link to your site.

  7. It doesn’t really work well with my favorite theme: “Brunelleschi”

    It also has problems with WP SuperCache which creates static copies of the pages on your site when they are accessed for the first time. Since your captcha isn’t dynamic on the front end (such as pulling via xmlrpc/ajax from the server for a captcha), the captcha question on any given post page remains the same every time and never changes.

    I think this is a fantastic plugin. It solves all the problems that make captcha technology problematic and painful. I just think it needs a different approach with regard to popular themes and front-end implementation.

    • Tommy, thank you very much for your feedback. We’re working on an update, to enable usage with custom forms via shortcode, small CSS inclusion for non-technical users and other fixes and we’ll definitely take your suggestions into account. (especially the xmlrpc/ajax is something we didn’t even think of)

  8. Hi, when I add the field to Contact Form 7 the captcha field title and the math question run together and there is no space between them. “Anti-spam testforty ÷ …” (should be some space or a new line between test and forty). Any suggestions?

    Thank you!

    • Just use some CSS to modify that for now. (we’ll add some CSS for that later on)

  9. Hello Everyone, is possible add this captcha functionallity as shortcode in a custom form?
    I have to add a custom form in a page in custom plugin, and i really want add this option, is this possible?

    • It’s not possible yet, but we’re working on that feature.

  10. Hi,

    I see that on to do list you put [1.1.0 – Multiple captcha on one page bug ] where i can find the 1.1.0 version. On it’s only 1.0.9. Anyway your plugin’s work great beside the place where i have two forms. If you can tell me what to change in the source code will be great.


    • Hi Alex,

      The multiple captcha bug has been already fixed (in 1.0.9). Are you using multiple Math Captcha fields with Contact Form 7? If so what is the issue? Please post a support topic on plugin forum for that (

  11. Hello,
    very nice plugin, but still a small problem (like Caitlin): question is splitted to 3 rows and I think user might get confused what to do. Could you please give me more details on how “to display the captcha in one line (row) using CSS inline-block or inline parameters for math captcha selectors”?
    Thanks and regards,

    • It was intentional to not to include anything unnecessary to MC, but we’ll add an optional CSS code soon.

  12. Hi,

    The plugin works great with CF7 on my standard contact form. However it doesn’t appear to be working on the comments form though.

    Is there an include or shortcode that should be implemented? Any help would be great.


    • Weird. It’s harder to setup for CF7 than for comments. Can you post a support topic on that and provide your site url – if possible we’d also like to take a look at you site’s backend.

  13. Hi
    if you want a free french translation please email me


  14. ..has anyone experienced being locked out of the WordPress dashboard through using this plugin?

    • @Rich, there was a bug in previous version of the plugin that might cause such thing under certain conditions. We fixed it some time ago. Did it happen to you?

      • @Bartosz, yes, it actually happened the other day but I was having other issues with the data base of that particular site so I’m not sure if it was related? I still haven’t resolved the problem but I will post a comment if I’m still having issues with the plugin when I have a chance to look at it again? I also had problems with another site that the plugin started to create an error, saying that the answer was incorrect, when it fact, it was actually correct? I tried deactivating and reactivating the plugin, and deleting and reinstalling it but it continued to give an error? I also tried deactivating other plugins to see if there was a compatibility issue but unfortunately in the end, I had to delete the plugin and use another plugin in its place!

      • …@Bartosz, I used Nucaptcha as a replacement plugin by the way! I would return to using your plugin but wonder if I used both, would that be necessary in your opinion? Or is that overkill? Cheers!

      • Rich, using those two is definitely an overkill for just one reason – Math Captcha is 100% effective – test it and report it if you experience any spam.

  15. it is very gooooooooooood

  16. Is there any way to toggle if it uses the format “83 – = 78″ or “83 – 78 = “? I only want the latter.
    Most math captchas ask a complete question and then the user has to fill in the answer, rather than filling in one of the variables to complete the equation, and I want to use that method only because it’s not as clear for users to see the text field *inside* the equation, especially on forms like mine where the text field is on a new line and breaks up the equation and makes it confusing.

    • Caitlin, there’s no such option for the moment. If it’s confusing for you may try to display the captcha in one line (row) using CSS inline-block or inline parameters for math captcha selectors.

  17. …love the plugin! I’m a little bit paranoid with spam, Malware and virus’s after recently having a site hacked into the site I’m working on! I’m also using Contact Form 7 Honeypot, Easy Captcha and a Quiz tag for my forms! Do you think that’s overkill? Would your plugin be sufficient coverage against spammers? Cheers!

    • We use Math Captcha on a couple of sites and the result is 0 (zero) spam, bots just can’t go through it. No matter if it runs for registration, comments, bbPress forum or Contact Form 7.

      • …appreciate your input! I’ll be sure to use it on all my future WP sites!

  18. I translated the .pot file into German, but though I translated the terms “ERROR” and the phrases “Please enter captcha value.” and “Invalid captcha value.” these messages still show up in English on form validation. What can I do?

    Thanks, Stephen

  19. I’m having the same problem as “Jim” with Contact Form 7. Math Captcha doesn’t show up.
    It works on other settings – LogIn, Comments, etc.

    Jim found a fix for Form 7 but didn’t share it. Can you enlighten me?

    Danny True

    • It work’s a bit different for CF7 – it just adds new Math Cpatcha field type to those available when you create a form in CF7. Just add it to the form and it should work.

    • click on the “generate tag” button and add the code to the contact form.
      also check the form when you are logged out

      • Thank you @Priscilla :)

  20. Do you have any screenshots of the front end on a comment? Couldn’t find and it doesn’t look like you are using on your site.

    • We’re using it here for bbPress and registration, so you can check it out. It will look and work the same on comments.

  • 14 plugins, 1 414 099 downloads and more to come. Interested?

    Stay in touch

    Enter your email to receive updates when new posts or plugins are published. (No spam, we promise.)

    Join the Site

    Get instant access to our free support forum.

    Sign up