Home › Forums › Front-end Issues › Comment spam via front end form textarea field › Reply To: Comment spam via front end form textarea field
Hi @tsmulugeta in acf_form add this arguments line:
'html_after_fields' => '<input type="text" id="honeypot" name="honeypot" autocomplete="off">',
in file functions.php, this code:
// CHECK PRE SAVE POST ACF
function honeypot( $post_id ) {
if($_POST['honeypot'] != ''){
die("You spammer!");
}
}
add_filter('acf/pre_save_post' , 'honeypot', 10, 1 );
in your css style:
#honeypot {display:none;}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.