WP runs so many prettifying filters on this stuff that it’s easy to get lost.
Here is what I ended up with:
remove_filter('comment_text', 'make_clickable', 9);
add_filter('pre_comment_content', 'strip_comment_links');
function strip_comment_links($content) {
global $allowedtags;
$tags = $allowedtags;
unset($tags['a']);
$content = addslashes(wp_kses(stripslashes($content), $tags));
return $content;
}
This scrubs out clearly defined links and removes filter that turns plain text links into properly tagged ones.
Related Posts:
- Using WordPress’ WYSIWYG for comments
- Add placeholder attribute to comment form fields
- Hook to edit an column on comments screen?
- Using filter to add additional fields to comment_form()
- How to remove or replace the log-in link for comment replies?
- remove_filter( ‘comment_author’, ‘floated_admin_avatar’ ); doesn’t work
- Filter custom posts with / without comments
- Filter In Reply comments from WordPress Admin Panel
- Alternative to the filter comment_reply_link
- How to use the ‘comments_number’ filter?
- How to use filter on comment submission/insert
- modifying the comment form
- What filter or action to replace comments or add new comment system
- Disable comments on all posts/pages
- Stop WordPress redirecting comment-page-1 to the post page?
- Would switching to InnoDB from MyISAM improve performance of comments table?
- Linking to Page Showing Only Comments Without Parent Post
- How can I limit the number of comments per registered user per day?
- Post Comments using WP REST API v2 in WordPress
- Show content only if member left a comment
- How to auto-approve internal pingbacks?
- Can I change what fields are displayed in the Comments form?
- Vanilla Forums as a replacement for WordPress comments?
- Wrong gravatar showing up?
- How can change wordpress comment reply text for specific pages only?
- How to make comment text field un-required?
- How to disable empty tags in comment_text()
- Expanding the allowed HTML tags in comments?
- comments are coming on improper posts
- Is there any way to override “break comments into pages” and “close comments for old posts” on certain posts, but not on others?
- Comments Pagination as an unordered list
- How to get comments from multiple post type?
- Check the Comment in Reply or Normal State
- Is it possible to make wp insert last comment onto another page
- How to allow only Admins or Logged In Users to post links in comments?
- wp_insert_comment error. puzzled by date value
- edit_comment capability for subscriber
- Hold comments for moderation only if user is not logged in
- Loading post comments after clicking a button
- Follow-up Comments Notification Without a Plug-in
- How to return 404 when called edit-comments.php?
- oEmbed does not work for comments
- Ability to comment on tags that represent a certain “issue”
- Yoast makes comment_reply_link function output plain link to comment instead of reply link
- Do I need to deal with WordPress SQL Injection
- using comments_template() in custom single-portfolio.php
- Same email for all comments
- Comments on homepage (index.php) are duplicated under posts
- How to integrate CLEditor to comment system?
- Comment Form – E-mail Not Required!
- Get a total count for all comments and display result
- Email notification to an email address other than admin for custom type post comments in wordpress
- Notification if Comment Author Field is left empty. E.g. change input border colour
- List comments received by every posts of an specific author
- How do I reply to comments from admin panel on a tablet PC?
- Disable comments for a user? [closed]
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- Ajax submit comments
- Comment Link from get_comments()?
- How do I automatically insert some text in the comment textbox on submit?
- I cannot view the comments
- if null or int(0) value to 0
- In wp_list_comments comment dates won’t work?
- Only show own comments in admin panel
- how to SELECT for the current post id?
- Sending comment notifications to different recipients depending on taxonomy terms
- Replying to comments
- Custom comment link
- How to display the user’s comment status on the front end
- unsetting required fields in the comment reply form
- Problem code and show comments
- Highlight comments made by registered users of the site
- How do I make Twenty Ten display comments on the home page?
- It doesn’t matter if I have more than one comment. get_comments_number still equal to one?
- Simple spam check for valid domain in commenter’s email address
- Allowing WordPress.org/com accounts on a self-hosted install
- How to remove the “comments” bit that appears next to or below the posts
- Sort post comments from newest to oldest in pagination
- Post comments don’t show
- Update post “A” on comment submition on post “B”
- Comments counter only for Authors Posts
- Pre- Approved Comment Capability
- Delete comments function
- Comment form not working
- Comments pagination on author page
- Comments page id wp_list_comments
- transition_comment_status gets called when untrashing comments
- spacebar is not working in input and textarea
- wp-editor-area textarea disapear on cancel-comment-reply-link click
- Conditionally process comments while ignoring replies
- Required Field for Comment parent only?
- Can I use WP comments for custom tables?
- How can I have a full comments.php for an easy editing of all its aspects?
- writing a plugin, how to disable the comment form altogether?
- Function to get a list of all comments on 1 post [closed]
- Auto delete WordPress comments
- How to disable comments on new blog post, but allow on new products?
- Query comments with non-empty ‘author_url’ value on Admin Comments Screen
- Customize the new comment notifications sent to the post author after the comment is approved
- Get approved comments or comments that the author is me