WordPress Plugin: reCaptcha


Add Google reCaptcha to comments forms on posts and pages. Additional filters are included for programmers to add reCaptcha to forms with ease.


As a site owner or developer it is frustrating having to store multiple coppies of the same API keys, for example if you were to have seperate reCaptcha plugins for comments and contact forms. For this reason hooks have been included allowing integration with F13 reCaptcha from other plugins.

Adding reCaptcha

To add a Google reCaptcha checkbox via filters can be achieved simply.

$v = '<form>';
    // Form fields
    $v .= apply_filters('f13_recaptcha_add');
    $v .= '<input type="submit" value="Submit">';
$v .= '</form>';
return $v;

Using the above code as an example, a Google reCaptcha checkbox will now be shown on the form. If you are unable to see the reCaptcha, it may be due to the visibility setting in the admin panel, try setting this to “Everybody”.

Validating reCaptcha

Similar to adding a reCaptcha checkbox, validation is achieved via a filter. The validation filter returns:

  • an empty string if validation passes
  • an error message if validation fails
$msg = '';
$recaptcha = apply_filters('f13_recaptcha_validate');
if (!empty($recaptcha)) {
    // reCaptcha has failed, show an error message
    $msg = $recaptcha;
} else {
    // reCaptcha has passed
    // Continue validation of other fields
    $msg = 'Success';
return $msg;


In order for F13 reCaptcha to operate, a google reCaptcha V2 Checkbox API key is required.

To obtain a Google reCaptcha API key:

  1. Log-in to your Google account or register if you do not have one.
  2. Visit https://www.google.com/recaptcha/admin/create.
  3. Enter a name for your API key
  4. Select “reCaptcha v2” > “I’m not a robot”
  5. Enter your websites domain name
  6. Read and accept the Google reCaptcha terms
  7. Submit the form
  8. Copy and paste the public and private API Keys to the appropriate field in “F13 Admin” > “Google reCaptcha”.

Google reCaptcha can be enabled for:

  • Everyone
  • Non logged in users (visitors)
  • Nobody (disabled)


F13 reCaptcha settings

Settings page for F13 reCaptcha.

Comments form with F13 reCaptcha enabled

Example comments form after installation of F13 reCaptcha.


Installing is as simple as 1,2,3 –

Via WordPress

  1. navigate to WP Admin > Plugins > Add New
  2. search for “F13 reCaptcha”
  3. install and activate


  1. download the source code
  2. upload the “f13-recaptcha” folder to your “wp-content/plugins” folder
  3. activate the plugin in WP Admin > Plugins


GitHub repository: f13dev/f13-recaptcha
Created: October 27, 2021 - 06:49pm
Last commit: October 30, 2021 - 09:12am
Forks: 0
Open issues: 0
Stars: 0
Watchers: 0
Description: N/A
git clone https://github.com/f13dev/f13-recaptcha


Rating: (0/5 from 0 rating)
Description:Add Google reCaptcha to the comments section on blog posts. Requires Google reCaptcha v2 Checkbox API key. Simple configuration via the admin settings page: * reCaptcha public key * reCaptcha private ...
Version:1.0.0Requires WordPress:5.0+Tested with WordPress:5.8.8Requires PHP:+Created:October 30, 2021Last updated:October 30, 2021 5:15am

5 tags for "WordPress Plugin: reCaptcha"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.