Hello loneriderbe,
To do this, copy and paste the following code into your functions.php.
function custom_remove_form_default_fields( $fields ) {
// Unset title, website and email fields
unset( $fields['email'] );
unset( $fields['url'] );
return $fields;
}
add_filter( 'comment_form_default_fields', 'custom_remove_form_default_fields' );
Hope that helps
Hello FadingMusic,
Applying the code works, it removes the website & email field. But when using the leave reply function a error code appears => “Error: please fill the required fields (name, email)”.
Which means that wordpress still expects an email to be provided. I disabled this in the Settings-discussion configuration page (deselecting “Comment author must fill out name and email”). So that now works, only I would have preferred that the names field remains mandatory. Any idea how to fix this?
As you can see from the link:
click here
the layout is not ok.
Any idea how to correct this?
Hi loneriderbe. Give this a try:
1. Settings > Discussion > Other Comment Settings, enable “Comment author must fill out name and e-mail”
2. Add the following to your child theme functions.php file:
// Modify comment form fields when author name & email are required
// Use default Name field, fill and hide Email field, remove URL field
function my_comment_form_fields($fields) {
// Use default comment Name field; no changes here
// Fill Email field with dummy value and hide field
$fields['email'] = '<p class="comment-form-email"><label for="">' . __( '', 'domainreference' ) . '</label> ' .
( $req ? '<span class="required">*</span>' : '' ) .
'<input id="email" name="email" type="hidden" value="email_not_required@domain.com" size="30" false /></p>';
// Remove website URL field
$fields['url'] = '';
return $fields;
}
add_filter('comment_form_default_fields', 'my_comment_form_fields');
3. Add this to your child theme style.css file:
#commentform p.form-submit {
margin-top: 100px;
}