| @@ -2,11 +2,8 @@ | ||
| 2 | 2 | // Do not allow the file to be called directly. |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | - | |
| 7 | -$id = 'g-recaptcha-response-' . uniqid(); | |
| 8 | - | |
| 9 | 6 | ?> |
| 10 | 7 | <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback" async defer></script> |
| 11 | 8 | <script> |
| 12 | 9 | var onloadCallback = function() { |
| @@ -13,9 +10,10 @@ | ||
| 13 | 10 | grecaptcha.execute(); |
| 14 | 11 | } |
| 15 | 12 | |
| 16 | 13 | function setResponse(response) { |
| 17 | - document.getElementById("<?php echo $id; ?>").value = response; | |
| 14 | + document.getElementById("captcha-response").value = response; | |
| 18 | 15 | } |
| 16 | + | |
| 19 | 17 | </script> |
| 20 | -<div class="g-recaptcha" data-sitekey="<?php echo esc_attr( $site_key ); ?>" data-size="invisible" data-callback="setResponse"></div> | |
| 21 | -<input type="hidden" id="<?php echo $id; ?>" name="captcha-response" /> | |
| 18 | +<div class="g-recaptcha" data-sitekey="<?php echo esc_attr( $site_key ); ?>" data-size="invisible" data-callback="setResponse"></div> | |
| 19 | +<input type="hidden" id="captcha-response" name="captcha-response" /> | |