1

I am currently using the normal noCaptcha reCaptcha from Google with the WordPress plugin "Password protected" and it works fine. Still a few visitors are confused that they have to click on "I am no robot". My sitekey has been withlisted by Google for their new invisible reCaptcha.

I added the necessary parameters to the submit button:

<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large g-recaptcha" data-sitekey="mySiteKey" data-callback="" data-badge="inline" value="<?php esc_attr_e( 'Log In', 'password-protected' ); ?>" tabindex="100" />

And the response is verified by this:

if ( ( $this->encrypt_password( $password_protected_pwd ) == $pwd && $pwd != '' && isset($_POST['g-recaptcha-response']) && $_POST['g-recaptcha-response'] ) || apply_filters( 'password_protected_process_login', false, $password_protected_pwd ) ) {

The captcha itself is shown, but after solving the captcha correct nothing happens anymore. It's like I never had submitted the button or the callback function in recaptcha is not answering properly.

So, what am I doing wrong? Or what do I have to change in the code?

Mr Meeseeks
  • 125
  • 11

1 Answers1

2

You must have a callback function set, otherwise the form cannot submit.

See this answer for more details.

https://stackoverflow.com/a/41147377

Community
  • 1
  • 1
Allen
  • 536
  • 7
  • 10