Posted on Leave a comment

Google’s Invisible Recaptcha with MemberPress Plugin

MemberPress has a great Match Captcha add-on included for free which works great for helping to prevent SPAM signups through MemberPress.

But what if you want something that works with more forms/plugins than just MemberPress?

There’s a great, free plugin called Invisible reCaptcha for WordPress that works with many popular plugins out of the box, and is not too hard to integrate with others.

In this post I’ll show you how to get it working with MemberPress.

First you’ll want to install the following two plugins:

  1. Invisible reCaptcha for WordPress
  2. Code Snippets

Next you’ll need to register for Google’s Invisible reCaptcha here:

After registering your site, you’ll be given a Site Key and a Secret Key that you’ll need to copy into the plugin’s settings page like so:

Configure the rest of the Invisible reCaptcha plugin as you wish. You’ll notice there’s no option there for MemberPress. As the plugin doesn’t have support for MemberPress included yet, we’ll need to integrate it ourselves with a little bit of code.

So, copy the following code and paste it into a new Snippet in the Code Snippets plugin.

// Integrates MemberPress with Invisible reCaptcha
function add_invisible_recaptcha_mepr_signup($membership_ID) {
    <div class="mp-form-row mepr_invisible_recaptcha">
      <?php do_action('google_invre_render_widget_action'); ?>
add_filter('mepr-checkout-before-submit', 'add_invisible_recaptcha_mepr_signup');

function validate_invisible_recaptcha_mepr_signup($errors) {
  $is_valid = apply_filters('google_invre_is_valid_request_filter', true);
  if(!$is_valid) {
    $errors[] = "Failed Captcha";
  return $errors;
add_filter('mepr-validate-signup', 'validate_invisible_recaptcha_mepr_signup');

It should look like this:

That’s it! Now you’ll have Invisible reCaptcha on your MemberPress registration forms like this:

Leave a Reply

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