By default, WordPress allows commenters to include a URL field when posting comments. Unfortunately, this often attracts spammers who use it to drop unwanted links. On ruachost.com, you can disable the URL field in the comment section using a simple PHP function.
Why Disable the URL Field?
-
Prevents spammy backlinks in comments.
-
Keeps your comment section clean and relevant.
-
Improves SEO by reducing low‑quality outbound links.
-
Enhances user experience by focusing on genuine discussion.
Steps to Disable URL Field in Comments
-
Log in to WordPress with an administrator account.
-
In the dashboard, go to Appearance → Theme Editor.
-
Select your active theme and open the functions.php file.
-
Add the following code snippet at the end of the file:
// Disable URL field in WordPress comment form function disable_comment_url_field($fields) { unset($fields['url']); return $fields; } add_filter('comment_form_default_fields', 'disable_comment_url_field'); -
Click Update File to save changes.
-
Refresh your site → The URL field will no longer appear in the comment form.
Important Notes
-
Always back up your theme files before editing.
-
Use a child theme to preserve changes during theme updates.
-
This only removes the URL field—it does not affect the comment text box or name/email fields.
-
If you later want to re‑enable the URL field, simply remove the code snippet.