Sanitize content from wp_editor

In short: it is in dependence of your context, the data inside your editor.

wp_kses() is really helpful, and you can define your custom allowed HTML tags.
Alternative, you can use the default functions, like wp_kses_post or wp_kses_data.
These functions are helpful in ensuring that HTML received from the user only contains white-listed elements. See https://codex.wordpress.org/Data_Validation#HTML.2FXML_Fragments

WordPress defines much more functions to sanitize the input, see https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data and https://codex.wordpress.org/Data_Validation
These pages are really helpful.

However, in your context should the wp_kses_post function, the right choice.

Leave a Comment