[Resolved] How To Remove URL Field From WordPress Comment Form

Home Forums Support [Resolved] How To Remove URL Field From WordPress Comment Form

Home Forums Support How To Remove URL Field From WordPress Comment Form

Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #579293
    lee

    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');
    #579411
    David
    Staff
    Customer Support

    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;
    }
    #579431
    lee

    Unable to delete

    [img]https://i.imgur.com/ozYjwzv.jpg[/img]

    #579437
    David
    Staff
    Customer Support

    Can you try clearing your caches

    #579447
    lee

    Hi David
    Clearing Caches can’t delete it

    https://fyphb.com/oneprovider/

    #589854
    Chandra

    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.

    #589904
    Tom
    Lead Developer
    Lead Developer

    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;
    }
    #589909
    Chandra

    thanks Tom. that code is working! while i use in generatepress too, can it be used on another theme?

    #590061
    David
    Staff
    Customer Support

    Hi Chandra, it’s a WP filter so any theme that respects that should be fine.

    #618543
    Anil
    #629475
    Anoop Kumar Vaishya

    nothing working

    #629491
    Leo
    Staff
    Customer Support

    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?

    #629494
    Anoop Kumar Vaishya

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

    #629498
    Leo
    Staff
    Customer Support

    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.

    #629503
    Anoop Kumar Vaishya

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

Viewing 15 posts - 1 through 15 (of 31 total)
  • The topic ‘How To Remove URL Field From WordPress Comment Form’ is closed to new replies.