how can remove Email and Website in comments ((Wordpress))
Solution 1
Create this plugin using notepad application from windows and remember to save the file with a .php extension Eg : removeurl.php
-
Copy and paste the below code in the file created in step 1
<?php /* Plugin Name: Remove Website Field Description: Removes the website field from the comments form */ add_filter('comment_form_default_fields', 'url_filtered'); function url_filtered($fields) { if(isset($fields['url'])) unset($fields['url']); return $fields; } ?>
Plugin Credit goes to TechHacking.com
Save your changes and upload it via FTP or through your web hosts file manager to the /wp-content/plugins/ directory
Go plugins menu option in your wordpress admin area and activate the plugin. With this simple hack you will be to remove the website field from the comment form.
If in any case the plugin does not work or the function does not work you can also use this method, I used this method in lot of my customization work and its proved to be very effect without any problem. To do so open your theme main css (Style Sheet) copy and paste below code
#commentform #url, #commentform #url +label {display:none;}
source : http://www.shariff.org/remove-website-field-comment-form.html
Solution 2
since the question specified talks about Email and Website Field, i modified @king Tohi's answer:
<?php
/*
Plugin Name: Remove Website and Email Field
Description: Removes the website field and email Field from the comments form
*/
add_filter('comment_form_default_fields', 'url_filtered');
function url_filtered($fields)
{
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields', 'email_filtered');
function email_filtered($fields)
{
if(isset($fields['email']))
unset($fields['email']);
return $fields;
}
?>
Hope this saves a soul...
EDIT:
In my case after disabling the field, the email field was compulsory so i had to disable it
settings > discussion >
unselectComment author must fill out name and email
Related videos on Youtube
King Tohi
Updated on June 04, 2022Comments
-
King Tohi almost 2 years
how can remove Email and Website section in Leave a Reply in Wordpress ? Like this : http://sceper.eu/2011/10/manson-family-blood-on-the-wall-2011-cr.html only see
Name (leave blank for Anonymous)
in Leave a Replyand i'm use wordpress 3.2.1 and use the default Wordpress comments
(( public_html/wp-includes/comment.php
and
public_html/wp-includes/comment-template.php ))
I'm removed this code from omment-template.php
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
But this is not work i think remove only this code is not enough !
now what do i do ?
-
pinaldesai over 12 yearsyou want to validate content of comment like comment should not have email / website URL ?
-
Kamil over 6 yearsSaved my soul. Thanks!