How to add google captcha step by step PHP-Wordpress

How to add google captcha step by step PHP-WordPress

Google Captcha saves us from spam and is very important these days.Adding it to website is straight forward.If you want to add it into your website then please follow below given steps.

1. Go and make an google account if you don’t have (If you have gmail account then you can skip this step).

2.Search “google captcha” on browser ,You should get google website as given below.

Now here click on “guide” in menu. It should give you list of available captcha versions on the next page.

Click on the version you want to install,For this Guide i will follow version v2.
As you can see there are 3 options under reCaptcha v2

Checkbox ,Invisible and android.You can go with what ever you like .

I use check box.Mainly check box will display “I am not a robot” message and user have to check it to proceed.

Once you click on the check box option you will get below given code.

		<form class="form-group" action="" method="post" enctype="multipart/form-data">
			<div class="form-group">
					<input type="file" name="image" class='form-control'>

			<div class="g-recaptcha" data-sitekey="your_site_key"></div>
			<div class="form-group">
				<input type="submit" name="data" value="Upload">


You need to add the script into the header of your website.


And the include html for checkbox into your form where ever you want to show google captcha.


This requires you to add a “Site Key”.It will be unique string just for your website.To get you site key Click on this Link
Here Your Site Key And Secret Key

Click on “Admin console” button ,It will open new page where we can add our website domain name to get site key.
Simple click on + icon to add your website.

After putting domain name google will display you the keys you required.
Just like given in this image,Keys are blurred for security reasons so in your case you will have your key that you can use.

Once you add code in your form and put the Site Key in it after saving it should be working, If face any problem then do comment.You are all set
with google captcha in next article we are going to validate the response from google captcha to ensure user have checked the captcha.

Validate the response of google captcha PHP (Check Here)