Site logo

Archived topic

How To Remove URL Field From WordPress Comment Form

30 replies · Started by lee on May 18, 2018

Viewing posts 1–15 of 31

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, 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.

nothing working

where have to add ? i'm putting in style.css

oh sorry i'm using to code same time
#commentform .comment-form-url {display:none;}

This archived topic is closed to new replies.