Simple reCAPTCHA

Use Google's reCAPTCHA with any custom form.

Author:Chris Dillon (profile at wordpress.org)
WordPress version required:3.0
WordPress version tested:4.2
Plugin version:0.6
Added to WordPress repository:18-05-2014
Last updated:22-04-2015
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:1
Plugin URI:http://www.wpmission.com/wordpress-plugins/si...
Total downloads:2 630
plugin download
Click to start download

What this plugin does

Provide a function to add reCAPTCHA to any custom form.

What this plugin does NOT do

Add reCAPTCHA to standard WordPress forms like logins or comments. For that, try Google Captcha by BestWebSoft.

Features

  • A single lightweight module for use by other plugins and themes.
  • Store the reCAPTCHA keys in one place, independent of any other plugin or theme.
  • Display and validate the reCAPTCHA with a few lines of code.
  • Four themes by Google (Red, White, BlackGlass, and Clean).
  • Multisite compatible.

This plugin has room to grow and all ideas and feedback are welcome.

How to use

Step 1. Enter your reCAPTCHA keys in Settings > Simple reCAPTCHA.

Step 2. Add the reCAPTCHA box to your form:

<?php
// is Simple reCAPTCHA active?
if ( function_exists( 'wpmsrc_display' ) ) { 
    echo wpmsrc_display();
}
?>

Step 3. Check the reCAPTCHA response in your server-side form validation:

<?php
// is Simple reCAPTCHA active?
if ( function_exists( 'wpmsrc_check' ) ) {

    // check for empty user response first (optional)
    if ( empty( $_POST['recaptcha_response_field'] ) ) {
    
        $errors['captcha'] = __( 'Please complete the CAPTCHA.', 'yourtextdomain' );
    
    } else {
    
        // check captcha
        $response = wpmsrc_check();
        if ( ! $response->is_valid ) {
            $errors['captcha'] = __( 'The CAPTCHA was not entered correctly. Please try again.', 'yourtextdomain' );
            // $response['error'] contains the actual error message, e.g. "incorrect-captcha-sol"
        }
        
    }
    
}
?>

Translations

Since version 0.6:

Can you help? Contact me.