Skip to content

Instantly share code, notes, and snippets.

@mrsize
Created February 4, 2020 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrsize/1acf463bf05e65437293aafa17ffd884 to your computer and use it in GitHub Desktop.
Save mrsize/1acf463bf05e65437293aafa17ffd884 to your computer and use it in GitHub Desktop.
CF7 Antispam Hide Honeypot Field Function
function wp1561_cf7_antispam_hide_honeypot_field() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'contact-form-7') ) {
echo "<style>.honeypotField{display:none;}</style>";
}
}
add_action( 'wp_head', 'wp1561_cf7_antispam_hide_honeypot_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment