Code to Disable HTML in WordPress Comments

All you have to do is simply open your functions.php and add the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    // This will occur when the comment is posted
    function plc_comment_post( $incoming_comment ) {
    // convert everything in a comment to display literally
    $incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
    // the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
    $incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
    return( $incoming_comment );
    }
    // This will occur before a comment is displayed
    function plc_comment_display( $comment_to_display ) {
    // Put the single quotes back in
    $comment_to_display = str_replace( ''', "'", $comment_to_display );
    return $comment_to_display;
}

The code above examines whether the Referrer specialist is from a Pursuit URL which incorporates Google, Yippee, Tasty, and so forth. In the event that a guest’s program says that the Referrer Specialist is from any pursuit site that we have determined, it will store a treat on their program called ‘sevisitor’ for a span of 1 hour from the time they went by your site. Most pursuit guests don’t go on the second page, yet in the event that your site is enhanced to increment site visits or has intriguing substance at that point, they will visit extra pages. All things considered, WordPress will show the Internet searcher Particular Advertisement that you have indicated to these clients for the span of one hour from the time they initially went to your webpage. In the event that this client bookmarks your site and returns to it one day later in light of the fact that they like your site, at that point they will be viewed as your general peruser and won’t see the Internet searcher particular substance.
I trust this substance was useful if yes please leave a coment for me and offer this post.
Much appreciated.

10 comments

  1. There are some of you out there who probably haven’t heard of http://www.camgirl.pw This is one of those must see sites. It’s full of extremely attractive ladies. You’re going to want to put down your sandwich when visiting this site. It’s impossible to focus on anything but the babes they have to offer.

Leave a Reply