How to safely sanitize a textarea which takes full HTML input

There is already a huge list built for you, which can be returned by wp_kses_allowed_html() based on context, and filtered via the wp_kses_allowed_html filter, also contextually. Creating that list should not be hard.

However, “the whole range of HTML tags that might appear in an HTML email” should be pretty close to the range allowed for an ordinary post so wp_kses_post() ought to get you a long way with little effort.

Leave a Comment