Categories
Code

How to remove WangGuard honeypot fields

WangGuard is a great plugin for blocking spam registrations. Without it, this site gets about 50 per day. No good!

I did encounter an issue, however: The <![if !IE]> tag was showing on my registration form for some reason. The code WangGuard adds inside the tag is used to generate a “honeypot” section: spam bots see the fake form fields but users don’t. Spam bots fill out the fields and when the form is submitted, WangGuard sees that the fake fields are filled in and knows the user is spam. The good news is that WangGuard still works without the honeypot fields.

Add the code below to your functions.php file to remove the honeypot fields:

/**
 * Get rid of WangGuard's honeypot fields on the registration form
 */
function kws_remove_wangguard_honeypots() {
    $i = 1;
 
    // WangGuard generates actions in a random position between 1 and 10, 
    // so we remove all actions that may exist.
    while($i < 11) {
        remove_action('register_form','wangguard_add_hfield_1' , $i);
        remove_action('register_form','wangguard_add_hfield_2' , $i);
        remove_action('register_form','wangguard_add_hfield_3' , $i);
        remove_action('register_form','wangguard_add_hfield_4' , $i);
        $i++;
    }
}
 
add_action('plugins_loaded', 'kws_remove_wangguard_honeypots');

By Zack Katz

Zack Katz is the founder of GravityKit and TrustedLogin. He lives in Leverett, Massachusetts with his wife Juniper.

2 replies on “How to remove WangGuard honeypot fields”

Hi,

Or you can go to WangGuard settings and disable the honeypot fields 😉

I don’t know why, but some users see that fields. I’m the WangGuard developer. I you now why, I can try to fix it.

Thank you for your post.

I have used custom form 7 plugin for 3rd party data actions which are used and send the data another platform. Is it possible to use honeypot integrate with it. I have changed the action URl and validation system. Which way i will fix problem and use the the plugin.

Comments are closed.