How To Remove The URL Field From WordPress Comments

26
803 followers
Updated

Have you ever wanted to remove the URL field from the comments section of your website? Well if you have, then you have come to right blog post.

Before we begin and just so we are clear, listed below is what we are looking to remove.

In order to remove this field the first thing we need to do is log into your WordPress . Once inside you will then need to navigate to Appearance > Editor:

Now, we will be making code changes to two files, comments.php and function.php.

Lets begin by clicking on the Comments link. One the page refreshes you will notice that the embedded code window displays new code similar to below.

You will be looking for the code that I have highlighted. Once you find it please DO NOT delete it, instead we are going to put to forward slashes at the beginning like below:

// $fields['url'] = '<input type="text" name="url" id="url" value="'. esc_attr( $commenter['comment_author_url'] ) . '" placeholder="' . __( "Website", "Avada" ) . '" size="22" tabindex="3" class="input-website" /></div>';

Inserting the slashes allows us to comment out the code from being run by the website. I recommend doing this anytime that you are adjusting theme templates, functions or pages so that if something goes wrong you are not stuck. Simply just go back to the files where you have added the slashes and just remove them and re-save.

Next, we are going to need to add some code to the functions.php file. As you did before navigate to the the "Theme Function" or functions.php.

Ok, we need to add the following code the bottom of the page, here is the code.

// Remove url field from comment form

function disable_comment_url($fields) {

unset($fields['url']);

return $fields;

}

add_filter('comment_form_default_fields','disable_comment_url');

It should look something like this:

Once complete this is what your comment form should look like and remember if anything goes wrong just go back and remove the forward slashes.

If you have any questions feel free to ask away!

Cheers

- Dwayne

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training

Recent Comments

25

Just what I needed thank you so much and have bookmarked it just in case I forget to.

You're welcome

This is brilliant, thank you! You should certainly make this a training when you can, and I will be back to 'like' it again! See you soon. :)

You're most welcome!

Thank you Dwayne. This should belong to the training. :) Bookmarked.

Thanks for the compliment and I would of made it training but I haven't been here three months yet. However, I will recreate it for training when I have that ability and then I can delete this post.

Cool! I believe soon you will be one of so many great training contributor here in WA. I really am looking forward to it. :)

Will try this on my site. Thank You! :)

Let me know if you have any issues and you're welcome!

Great post , thank you for sharing.

Thanks Evan and it's my pleasure!

Thank you for the post!

You're welcome Farshid!

Thanks Dwayne. Good to know.

You're welcome Saul!

Thanks Dwayne, I have bookmarked it. Useful. :))

You're welcome!

Thanks Dwayne, this will help with dead backlinks from comments.
John

My thoughts exactly and I am glad that you found it useful!

This is helpful. Thanks Dwayne!

My pleasure and you're welcome.

See more comments

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training