Just FYI for anyone wishing to utilize the my_honeypot_html_override function to modify the entire outputted HTML for the honeypot field, you can get a listing of the array elements supplied to the $args parameter by inserting the following line just prior to the “return $html;” line in the function (only for testing of course):
echo "<script>console.log( '" . json_encode($args) . "' );</script>";
If you wish to modify the HTML and also opt to “Move inline CSS”, do not modify the span element’s id attribute as that will cause the field to be displayed and visible.
@ryan:
The honeypot might be made more effective by eliminating the “/hp[a-zA-Z0-9]{13}/” signature of the span element’s id attribute. Please allow me to suggest:
$atts[‘span-id-prefix’] = $tag->get_option( ‘span-id-prefix’, ‘id’, true );
$unique_id = uniqid($atts[‘span-id-prefix’]);
Also, the class of the label element, “hp-message”, does not seem to be defined anywhere. I wonder if that honeypot signature also be eliminated. Or, perhaps it could simply be replaced with the same user-custom class that is used for the input element.
And finally, thank you very much for your time.