Remove URL Field From WordPress Comment Form

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 222

    Remove URL Field From WordPress Comment Form

    Hello,

    How to Remove URL Field From WordPress Comment Form?

    Please find the attached screenshot for your reference. Thank you in advance!

    image.png​
  • wisly.k
    Senior Member
    • May 2022
    • 195

    #2
    1. Log into your WordPress dashboard.

    2. Navigate to Appearance > Editor and select functions.php.


    Add the following code at the last line in the functions.php

    add_filter('comment_form_default_fields', 'website_remove');

    function website_remove($fields)

    {

    if(isset($fields['url']))

    unset($fields['url']);

    return $fields;

    }


    The above code defines a function called website_remove() that removes (or unsets) the URL field.

    By using the add_filter() hook, we pass the argument to the default WordPress function comment_form_default_fields, which contains the fields of the comment form.
    ​

    Comment

    VPS Hosting
    Working...
    X