Posted inWordpress

Honeypot spam protection for Enfold themes Avia builder form

With over 209,732 Sales ( at the moment of writing this post ) , Enfold is one of the most popular wordpress theme.  The Avia builder that comes with Enfold is also has a lot of features that really helps the user to developer quickly.

One of the feature of Avia builder is the forms.  You can very easily and quickly create a form with avia builder. Though the forms functionality is quite basic , it does have recaptcha support. But some people don’t like recaptcha ( like one of my client ) and wants to use old style honeypot spam protection with the avia builder form.

So i wrote a very simple code for him that adds a hidden input field on all avia builder forms, that will be hidden by default and should not be filled. If any bot fills the hidden input field , the form will not be submitted and will give a error message.

function add_honeypot( $elements ) {
    $elements['avia_honeypot']  = array( 'type'=>'text', 'label'=>'Your Name', 'check'=> 'must_empty', 'class'=>'hidden hideany');
    return $elements;
add_filter( 'avia_contact_form_elements', 'add_honeypot' );


You can install this as a plugin in your website ( Download )  or you can just copy the code above and add it to your WordPress themes functions.php file.



Spam bots can not tell the difference between regular field and honeypot field.  So they will fill it and the submission will be failed like the image below.


Hope this helps. Let me know your thoughts in comment.