Create customized captcha field to wordpress comment form without Plugin
I did asked a similar question some time ago but i couldn't get a useful answer. I would like to ask again.
I actually wanted to add a field called "security" to prevent those autobot to send me spam through the wordpress comment form. And i have a specific answer for this security field. I want my comment form to be submitted oif only the answer is correct or else the comment not submit.
You can see the example at my existing website. In my website, i have set the answer to be 17. The form can only be submitted successfully if the answer is correct.
Here is the code i have to process the enquiry form in my website(but I have cut the code short for easier reference):
Php code Part 1:
$security = $_POST['security'];
if ($security=="10") {
mail($to, $subject, $message, "Jornes");
header("Location:/?security=submitted");
}
else {
header("Location:/?security=error");
}
Php code Part 2:
?php
$s=$_GET['security'];
if ($s=="error") {
echo ('p class="errorMessage"Ops! Something went wrong at the security field. Please fix the error and retry!/ppnbsp;/p');
}
?
I would like to ask, how shall i get this code implemented to wp-comment-post.php or any other solution you have? Thanks a lot!
But, i am not going to use plugin. Any expert here?
Topic captcha comment-form Wordpress
Category Web