• Resolved Andrew Bondar

    (@kronos1705)


    Hello.
    I want to delete the URL field (site) from the comment form, how can this be done? Tell me, please, the solution.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi there,

    Assuming you’re using the default comment form in the theme, the url field can be hidden by adding the css below to the customizer in Appearance > Customize > Additional CSS:

    .comment-form-url input#url {
        display: none;
    }

    If the css does not work for you, please keep it in the customizer, and post a like to your site here so we can take a closer look.

    Thanks ??

    Thread Starter Andrew Bondar

    (@kronos1705)

    I’ll try, thanks.
    And you can do not through the styles, but edit the code in the file comments.php?

    The css should be added to the customizer in Appearance > Customize > Additional CSS.

    https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/

    Thread Starter Andrew Bondar

    (@kronos1705)

    Apparently I did not say so, I’m sorry.
    I’ll try to explain my thoughts.

    There is a theme file:
    comments.php
    There is a line in it:

    'url' =>
    			'<p class="comment-form-url">' . '<input id="url" name="url" type="text" placeholder="' . __('Website','baskerville') . '" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">Website</label></p>')

    She is responsible for outputting the field “site” or am I mistaken?
    Solving my problem through the CSS is simple, but I just want to know all the possible options with a theme Baskerville.

    P. S. Thank you for giving me time.

    Adding the css I posted to the customizer will hide the field, visitors to your site will be unable to see it.

    The alternative method would be to create a child theme to override comments.php file from the parent theme to remove the field. This is the more complex option.

    If you’re not familiar with child themes, you can find info in the links below:

    https://codex.www.ads-software.com/Child_Themes
    https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

    You’d need to create a child theme, place a copy of comments.php in the child theme, then remove the line that adds the url field.

    Please note: files in Baskerville should not be edited directly. Any changes that have been made to files would be overwritten if the theme is updated – this is why a child theme would be required.

    Thread Starter Andrew Bondar

    (@kronos1705)

    I’ll get acquainted, thank you.

    You’re welcome ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to delete a URL field (site) from a comment form’ is closed to new replies.