CAPTCHA Tutorial – Add CAPTCHA to Form on Your Site

CAPTCHA Tutorial – Add CAPTCHA to Form on Your Site

One of the most annoying things to experience on your site online is comment spam especially when you are a beginner online. There are a myriad of ways through which you can reduce comment spam, and CAPTCHA is one of them. You may not have time to employ many of the methods that reduce the ever upping comment spam and here is where CAPTCHA comes handy. It is simple to install on your site and is also easy to use. It has proven to be very useful in many sites and thus you need to try it out on your site.

Once you add CAPTCHA to form, you can reduce up to 80% of comment spam and you can enjoy its functionality. There are various ways through which you can add CAPTCHA, and you should select that which is convenient for you.

What is CAPTCHA?

CAPTCHAThis system controls all the spam comments sent from automated bots. Once you add CAPTCHA to form, any commentators can be presented by an image with distorted digits and letters that they should enter to enable publishing the comment. Once the letters and digits have been entered correctly, CAPTCHA distinguishes automated bots and humans and publishes the comment.

Pros and Cons of Using CAPTCHA

The main advantage of using CAPTCHA is reducing comment spam since most comment spam is sent through automated bots. It significantly reduces spam, and your site can be safe. You can combine the use of CAPTCHA with Askimet, and you can have reduced comment spam almost completely.

However, CAPTCHA does not stop all spam comments as a significant number of spam comments are submitted by human users. The users may want to submit links to some insignificant or dubious sites online that are not related to the content of your blog.

Also, the added step in the commenting process is a turndown to many of your readers and makes them feel less motivated to comment on your site. Most people may feel annoyed and fail to comment at all.

Implement CAPTCHA

The use of WordPress plugins is one of the easiest ways to add CAPTCHA to WordPress comments. There are many plugins that you can use.


To start using CAPTCHA on your site, you need to install and activate WP-reCaptcha plugin on your site. After you have installed and activated the plugin, go to your WordPress Settings tab and select WP-reCAPTCHA to configure it.


This plugin requires API keys. You need to visit reCAPTCHA website to generate the API keys. On the reCAPTCHA website, you need to sign up using your Google Account and the keys can be generated automatically. The generated keys are required on your WP-reCAPTCHA page. Copy and paste the keys on the page.

reCaptcha keys

After pasting the API keys, you need to check the box just next to the “Enable for Comments Form” that can activate the plugin for your comment form. The plugin allows you to hide reCAPTCHA to visitors who are registered on your site. You can also choose a color for the CAPTCHA box. Once you have done all the settings, hit Save reCaptcha Settings, and you can start doing it.

reCaptcha Refresh

Easy Captcha Plugin

This is a great option when you need more Captcha options. Install and activate the plugin on your WordPress site to get started. Go to Settings >> Easy Captcha and configure the installed plugin. It lets you add hidden Captcha, Google’s reCaptcha or a simple Captcha. The hidden capture works like honey pot technology where bots are captured, but human users do not see anything.

The simple CAPTCHA applies the use of an obvious image which is clearly seen by your human users, and they can fill it. You can also choose the Google reCaptcha option.

Easy Captcha

The Easy Captcha plugin also allows you to add Captcha form to login, registration and password rest pages giving you more protection. Check the example in the following.

Easy Captcha sample

Securimage-WP Plugin

Install the plugin and activate it to get started. After installation and activation, go to Settings and select Securimage-WP for configuration. The plugin has the most options and thus the reason most people like it. The options may be overwhelming to a WordPress beginner.


The plugin does not use Google reCaptcha but allows you to generate your captcha image by the use of the php GD image library. It also offers the refreshed button and audio captcha button. People with special needs find this plugin very useful.

Securimage-WP refresh

Note that always uncheck the box next to Show “Protected By” Link as it will show a link to the plugin’s site.

How to Add CAPTCHA to Form Manually

If you do not like the WordPress plugins, you can use codes to set the captcha to forms in your site. You need to ensure that in your forms, the CAPTCHA image is displayed well, and there is a field where people enter the Captcha code for validation. The HTML code can appear as following.

Captcha code

When using JavaScript validation, you can see that the code has been entered but cannot know whether the code is right or not. Therefore, you can do this by asking help from professionals. The JavaScript validation form appears as shown below.

JavaScript validation code

In the server side, the code entered can match the session variables as set on the captcha.php script.

captcha.php script

When you are setting a session variable, call session_start()in the server side script used for validation and in the captcha.php script because the two files are processed independently. You can use callsession_destroy() after the verification of the submitted code.