I’d like to be able to filter out a commenters ability to add hyperlinks in their comment text.
I removed the “websites” field from the mix to reduce the amount of spammage already (see: Removing the “Website” Field from Comments and Replies?“) which has helped a lot.
By default, they can use the ‘< a ‘> tag to do so in the comment box text, which allows spammers to embed hyperlinks to their sites.
Is there a way to filter out that capability in the wysiwyg editor for comment fields?
WP runs so many prettifying filters on this stuff that it’s easy to get lost.
Here is what I ended up with:
This scrubs out clearly defined links and removes filter that turns plain text links into properly tagged ones.
Another solution –
The function that will remove all
<a>...</a>
from a text (Probably it’s better to use strip_tags instead of regex here):Remove links from all new comments permanently, before they are insterted in the db:
Or, remove links before we output them to the screen (Your theme should run the ‘comment_text’ filter somewhere in a template file):