Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A collection of CF7 Honeypot filter examples for customizing the output of the CF7 Honeypot field.
// Customize Honeypot Message
function my_honeypot_message_override( $msg ) {
// Change the $msg value to your custom message text.
$msg = 'By filling in this field you may cause the universe to implode and your mom will be disappointed in you.';
return $msg;
add_filter('wpcf7_honeypot_accessibility_message', 'my_honeypot_message_override', 10, 2 );
// Customize Honeypot container CSS styles
function my_honeypot_css_override( $css ) {
// Change the $css value to your custom CSS to be applied to the honeypot's parent wrapper element.
$css = 'display:block; visibility:visible;';
return $css;
add_filter('wpcf7_honeypot_container_css', 'my_honeypot_css_override', 10, 2 );
// This filter allows you to modify the entire outputted HTML for the honeypot field. Use carefully.
function my_honeypot_html_override( $html, $args ) {
// You have access to both the default generated $html as well as the various $arg used to compile it.
return $html;
add_filter('wpcf7_honeypot_html_output', 'my_honeypot_html_override', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment