Support » Plugins and Hacks » Hacks » how to validate reCAPTCHA in #commentform

  • I have added reCAPTCHA into commentform and I can see the reCAPTCHA in comment form. But I have no idea where and how do I need to validate reCAPTCHA. I saw the function in my themes.
    // comment form validation
    jQuery(“#commentform”).validate({
    errorClass: “invalid”,
    errorElement: “div”,
    errorPlacement: function(error, element) {
    error.insertAfter(element);
    }
    });
    jQuery(“#commentform”).fadeIn();

    Thanks,
    Alex

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You do not want to use client side script such as jQuery to verify CAPTCHAs, the spammer has control of the code and can easily sidestep the verification process. Verification must be server side.

    Assuming your form action still goes to wp-comments-post.php, you can verify the reCAPTCHA by adapting Google’s suggested server side code to run from the WP action hook ‘pre_comment_on_post’.

Viewing 1 replies (of 1 total)
  • The topic ‘how to validate reCAPTCHA in #commentform’ is closed to new replies.