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');