• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2552

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Register
  • Videos
  • Log in

How To Remove Allowed HTML Tags Text After Comment Form Fields

One of the first things I noticed when converting my Genesis child theme from XHTML to HTML 5 was the changes to the comment form. By default, WordPress includes comment form allowed tags in the source code.

The problem I have found with these tags is that they can attract spam comments which include HTML links.

This may have something to do with the fact the source code for the comments form includes code which can be easily scanned by link posting spam bots.

Comment Notes After

comment_notes_after generates a string of text which is displayed after the set of comment fields.

You can view the exact code included in the WordPress comments form template WordPress comments template.

Here’s the code which I extracted from the comments template.

Here’s an image of the default code for comments notes after.

comment notes after

This code is basically telling spam bots that they can leave HTML links in your comments form which will certainly increase the rate of spam you need to moderate.

Preventing Comment Form Spam

No doubt its easy to stop spam comments by configuring your Discussion settings so that all comments require approval by an administrator but that still causes frustration and no one likes that.

Akismet does a pretty good job of filtering spam comments but I have noticed the addition of comment form allowed tags increases the amount of comments which need moderating.

So what’s the best solution?

Remove the allowed tags from the comment form completely using a PHP filter or hide it using CSS code.

CSS code won’t remove the source code which spam bots scan so its far better to use PHP code to solve this problem once and for all.

Unset & Remove Form Allowed Tags

Using the WordPress comments_form_default filter you can prevent the text from displaying form allowed tags after the comment fields.

Here’s the code to unset and remove the comment form allowed tags. It also removes the string of text and HTML before and after the comments form.

You could also use the genesis_comment_form_args filter to do the same job and i will add that code to this post shortly.

Plugin

This plugin also removes comment for allowed tags as well as before and after notes.

Remove Other Comment Form Fields

If you want to customize your comment form further and reduce the chance of comment spam, here’s a post about how to reduce comment spam.

The post also includes code to remove the web site URL field from the comments form which will help prevent spam comments further.

How Effective Is This Solution

Since i have removed the comment form allowed tags from this site, the spam has stopped completely.

How about you? Did you update to HTML 5 and have the same problem? Did removing the allowed tags solve the problem?

More Solutions For Customizing Your Comment Form

  • Customize Comment Form Text Area & Label
  • Open Comment Author Link In New Window
  • Modify Text Before & After Comment Form
  • Customize Comment Form Place Holder Input Text Fields & Labels
  • Style Comment Form Submit Button
  • Remove Comment Form Support From Any WordPress Theme

Do You Have Any Tips?

Please share any tips you have or experience preventing comment spam. Thanks

Comments

Primary Sidebar

How it works :

I write tutorials for you which include the custom code you need for a flat $49.99 fee. You get 1 tutorial request as well as access to all 2500+ existing tutorials for 1 month.

  • Premium Members Only
  • Sign Up
  • Support