Wordpress remove <sup> to keep comment

I am trying to implement a WYSIWYG editor in WP comments section. I am having a lot of difficulty storing HTML data in a WordPress database. WP automatically breaks many HTML tags. I was able to recover the tags

through the preprocess_comment filter. I added the wpautop () filter to the content. Line breaks now appear. But when I want to use the tag, WordPress removes it too.

I am using Trumbowysiwyg js solution to replace the default comment textbox with wysiwyg editor. The HTML looks good when using the editor. It has all the HTML tags, but after the comment is saved, those tags are removed. Can anyone tell me how to enable storing HTML comments in the database?

+3


source to share


1 answer


WordPress keeps a list of allowed tags that you can use in comments, of course you don't want users to post whatever html they want. Therefore, I suggest that you edit the valid tags so that they are not removed.

add_action('comment_post', 'allow_more_tags');

function allow_more_tags() {
   global $allowedtags;
   $allwedtags['sup'] = array('class'=>array());
} 

      



Likewise, you can add whatever tags you like and even allow specific classes to be added to them.

+3


source







All Articles