in PHP, WordPress

WordPress Google reCAPTCHA snippet

Preventing from spam bots in WP is in good level, but only for comments. For preventing from registration of spambots we need an extra plugins, most of them do alot of unnecessary for us work, like adding captcha for comment forms (why when we have Akismet?), on login forms and in some other places that plugins thinking that they know better than devs 😉

So I wana share my plugin snippet that I am using, it require just few constants to be set and it is done. The only that it do is adding and reCAPTCHA on register forms on WP sites, when it is enabled.

The only to do that it require is to modify the code in configuration block

/**
 * Configuration
 */

// Set with your private key.
define('e01_WP_reCAPTCHA_private_key', ''); 

// Set with your public key.
define('e01_WP_reCAPTCHA_public_key', '');

// Available options for appearance are: 'red', 'white', 'blackglass' or 'clean'
define('e01_WP_reCAPTCHA_theme', 'clean');

// Set message that u wana show when error.
define('e01_WP_reCAPTCHA_message', '<strong>Error:</strong> Wrong captcha code, try again.');

and install as normal WP plugin.

Download source: e01-wp-recaptcha.php

Write a Comment

Comment

    Webmentions

  1. WordPress Google reCAPTCHA v2 – e01's personal blog

    […] is update of previous script of WordPress Google reCAPTCHA, to supports reCAPTCHA […]