Add phpcaptcha in contact form 7 with validation in WordPress which you can download from below w3schools website.
http://www.w3schools.in/php-script/captcha/
1. Extract phptextcaptcha in your theme directory of wordpress.
your directory will be like.
yourthemepath/phpcaptcha/css
yourthemepath/phpcaptcha/font
yourthemepath/phpcaptcha/captcha.php
yourthemepath/phpcaptcha/phptextClass.php
where captcha.php path will be generating an image and put the value of it session $_SESSION[‘captcha_code’];
2. In contact form you need to put
you can further style this with css.
3. Now last part is validating this with contact form 7.
put the code in function.php
session_start();
add_filter( ‘wpcf7_validate_text*’, ‘custom_captcha_text_validation_filter’, 20, 2 );
function custom_captcha_text_validation_filter( $result, $tag ) {
if ( ‘captcha_text’ == $tag->name ) {
//var_dump($_SESSION);
if ( $_SESSION[‘captcha_code’] != $_POST[‘captcha_text’] ) {
$result->invalidate( $tag, “Invalid captcha code!” );
}
}
return $result;
}