Cloud Service >> Knowledgebase >> WordPress >> How to Remove the URL Field from WordPress Comment Box?
submit query

Cut Hosting Costs! Submit Query Today!

How to Remove the URL Field from WordPress Comment Box?

WordPress provides a powerful platform for creating websites, and it includes a comment section that allows visitors to interact with your content. By default, WordPress includes a URL field in the comment box, where users can enter their website link. However, in some cases, you might want to remove this URL field for a cleaner look or to prevent spam.

Here's how to remove the URL field from the WordPress comment box:

1. Use a Plugin (Easy Way)

The easiest method to remove the URL field is by using a plugin. There are several plugins available for WordPress that allow you to modify the comment section, including removing the URL field.

Step 1: Go to the WordPress dashboard.

Step 2: Click on “Plugins” and then “Add New.”

Step 3: Search for the plugin “Disable Comments.”

Step 4: Install and activate the plugin.

Step 5: Once activated, go to Settings > Disable Comments.

Step 6: Select the option to disable comments for your entire site or on specific post types, including the URL field.

This method is quick and doesn’t require any coding knowledge.

2. Modify Theme Files (Advanced Method)

If you prefer not to use a plugin, you can remove the URL field manually by editing your theme files. This method requires some knowledge of PHP and WordPress themes.

Step 1: Go to your WordPress dashboard.

Step 2: Navigate to Appearance > Theme Editor.

Step 3: Find and select the file comments.php in your active theme.

Step 4: Look for the code that displays the URL field. It might look like this:

php

    

    

Step 5: Remove the entire block of code above to eliminate the URL field from the comment box.

3. Use Custom Functions (No File Editing)

If you prefer not to edit theme files directly, you can add a small function in your theme’s functions.php file to remove the URL field.

Step 1: Go to Appearance > Theme Editor.

Step 2: Open the functions.php file.

Step 3: Add the following code at the bottom of the file:

php

function remove_comment_url($fields) {

    unset($fields['url']);

    return $fields;

}

add_filter('comment_form_default_fields', 'remove_comment_url');

This function uses WordPress’s filter hooks to remove the URL field from the comment form. No file editing is required beyond this simple function.

4. Consider Using Custom CSS (Temporary Solution)

If you want to hide the URL field visually without removing it from the code, you can use custom CSS. This method is less efficient than removing it completely but can work in some cases.

Step 1: Go to Appearance > Customize.

Step 2: Click on Additional CSS.

Step 3: Add the following CSS code:

css

.comment-form-url {

    display: none;

}

This will hide the URL field from view but not remove it from the code. It’s a temporary solution if you want to keep the field hidden but may want to enable it in the future.

Conclusion

 

Removing the URL field from the WordPress comment box can be done in several ways. Using a wordpress plugin is the easiest method while editing the theme files or adding custom functions provides more control. Be sure to choose the method that best fits your technical expertise and site requirements.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!