Skip to content

Instantly share code, notes, and snippets.

@walterebert
Created December 28, 2017 10:15
Show Gist options
  • Save walterebert/8601431f7c5d260b2682f030790ed7bd to your computer and use it in GitHub Desktop.
Save walterebert/8601431f7c5d260b2682f030790ed7bd to your computer and use it in GitHub Desktop.
WordPress snippet: Remove email field from comments
<?php
add_filter( 'comment_form_default_fields', function( $fields ) {
$require_name_email = get_option( 'require_name_email' );
if ( ! $require_name_email ) {
unset($fields['email']);
}
return $fields;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment