Archived topic
How To Remove URL Field From WordPress Comment Form
30 replies · Started by lee on May 18, 2018
Invalid code below
add_filter('comment_form_default_fields', 'website_remove');
function website_remove($fields)
{
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
function crunchify_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','crunchify_disable_comment_url');
Hi Lee,
can you try this:
add_filter('comment_form_default_fields','generate_disable_comment_url');
function generate_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
Unable to delete
[img]https://i.imgur.com/ozYjwzv.jpg[/img]
Can you try clearing your caches
Hi David
Clearing Caches can't delete it
Hi, since WordPress 4.9.6 this code won't work. Maybe because there is an additional field related to GDPR in comment form. And Google results are note helping because there is no new code that compatible after the 4.9.6 update.
Anybody can confirm this and maybe create updated solution?
Thanks.
Sorry we didn't get back to you, lee!
Can we try this instead?:
add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}
function tu_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
thanks Tom. that code is working! while i use in generatepress too, can it be used on another theme?
Hi Chandra, it's a WP filter so any theme that respects that should be fine.
Code here is working fine:
nothing working
I just tested the code here and it worked nicely:
https://generatepress.com/forums/topic/how-to-remove-url-field-from-wordpress-comment-form/#post-618543
How are you adding the code?
where have to add ? i'm putting in style.css
Try one of these methods:
https://docs.generatepress.com/article/adding-php/
Code Snippets is the easiest if you aren't using a child theme.
oh sorry i'm using to code same time
#commentform .comment-form-url {display:none;}