By hooking into the wp_kses_allowed_html filter, you have full control over what HTML is allowed to be displayed in post and comment content.  

Unfortunately the $context provided by the filter’s 2nd parameter does not describe the difference between a post and a comment, so we have to alter them all equally.

If you have any thoughts on how to improve this snippet, let me know below!

About the Author

Jonathan Daggerhart

Long time Drupal and WordPress developer. I like to write modules and plugins, and I dabble in frontend and design.

Leave a Reply

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