How to verify user response using reCaptcha V3 on a custom HTML form in Wordpress?

66 Views Asked by At

I am working a site and the client wanted to add some Eloqua HTML forms into the site. I want to add reCaptcha to these forms as the client was concerned about spam. I have looked at the v3 google documentation and looked at countless guides and videos and I am still stumped.

I am still relatively new to custom PHP for Wordpress implementations, so I am learning as I go.

So far I have managed to hook the form up to a JS function, which then does an AJAX request on the server with the token. The AJAX request runs a function on the server which calls the reCaptcha API. I have verified the token and if its a human, it returns true. If true, the function on the client side submits the form.

I thought this was correct, but I am having doubts as I believe the submission should be done on the server side rather than back on the client side. But the form action is an Eloqua function e.g. https://s########.t.eloqua.com/e/f2 and all the guides I have seen seem to just send an email.

The reCaptcha seems to work, but I have a feeling the form still may get spammed.

Also I have looked at plugins but all the ones I looked at seemed to be implementations for CF7, not for use on custom HTML forms.

Any help would be greatly appreciated!

0

There are 0 best solutions below