/acf-recaptcha

reCAPTCHA Field Type ACF v5

Primary LanguagePHP

ACF reCAPTCHA Field

Advanced Custom Fields custom field type for Google's No-CAPTCHA reCAPTCHA, to be used on frontend forms.

![Google reCAPTCHA] (https://www.google.com/recaptcha/intro/images/hero-recaptcha-demo.gif)

Support for ACF v4 coming soon.

About No-CAPTCHA reCAPTCHA

You can find more information on reCAPTCHA here. Google introduced a new form of CAPTCHA in 2013 that proved to be easier to solve by humans yet considerably harder for bots to bypass, by introducing a simple checkbox which is all that's needed for humans to pass the verification.

Instructions

Generating an API Key

If you haven't already, generate your API keys first. You will need the site key and secret key.

Installation and Usage

This plugin requires cURL to be enabled on your server, as it makes use of Google's PHP library.

  1. Copy the acf-recaptcha folder into your wp-content/plugins folder
  2. Activate the plugin via the plugins admin page
  3. Create a new field via ACF and select the reCAPTCHA type (under Custom)
  4. Enter you site key and secret key into ACF options.

That's it! It should work out of the box, as long as your API keys are correct and valid for your domain.

ACF PHP API

If you are using ACF via PHP API (https://www.advancedcustomfields.com/resources/register-fields-via-php/) this is a sample code for reCaptha field:

array (
  'key' => 'field_recaptcha',
  'name' => 'recaptcha',
  'type' => 'recaptcha',
  'label' => 'Prove your humanity',
  'site_key'	=> 'SOME_VALID_RECAPTCHA_KEY',
  'secret_key'	=> 'SOME_VALID_RECAPTCHA_SITE_SECRET',
  're_theme' => 'light', // Other options: 'dark'
  're_type'	=> 'image', // Other options: 'audio'
  're_size'	=> 'normal', // Other options: 'compact'
),

About

Version 1.0

Written by Irvin Lim. If you encounter any issues, do open one.

If you have any other questions, contact me here!