Get rid of links in your wordpress comments
February 12, 2009 · Print This Article
As you wordpress blog became one of the most popular WordPress related blogs, you had to face the problem of people inserting links in comments. Some links are relevant, but some aren’t at all. here is a solution to say goodbye to links in comments.
Just paste this code in your function.php file. Once the file is saved, you can say goodbye to links and other undesired html in your comments.
function plc_comment_post( $incoming_comment ) {
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
$incoming_comment['comment_content'] = str_replace( “‘”, ‘'’, $incoming_comment['comment_content'] );
return( $incoming_comment );
}
function plc_comment_display( $comment_to_display ) {
$comment_to_display = str_replace( ‘'’, “‘”, $comment_to_display );
return $comment_to_display;
}
add_filter( ‘preprocess_comment’, ‘plc_comment_post’, ”, 1);
add_filter( ‘comment_text’, ‘plc_comment_display’, ”, 1);
add_filter( ‘comment_text_rss’, ‘plc_comment_display’, ”, 1);
add_filter( ‘comment_excerpt’, ‘plc_comment_display’, ”, 1);






















Comments
Got something to say?
You must be logged in to post a comment.