Free Tutorials WordPress Tips

Remove All HTML Tags From Comment Content Text In WordPress

A premium user asked how to remove links from comments which is the reason for publishing this code.

Add the following PHP code to your child themes functions file.

add_filter( 'comment_text', 'wp_filter_nohtml_kses' );

The code converts this link :

<a href="" rel="nofollow"></a>

Into this :


So its not clickable and the nofollow attribute has also been removed.

Leave a Reply

Your email address will not be published. Required fields are marked *