admin管理员组

文章数量:1405165

I have a textarea inside a custom widget that needs to hold some html tags. I've noticed that if I use the esc_html or esc_attr or strip_tags to take the things secure, I will lost all the html I use. How I can keep the html tags in place, I just need to add an <i> tag and <p> or <h>, <a> tags. Any suggestion?

I have a textarea inside a custom widget that needs to hold some html tags. I've noticed that if I use the esc_html or esc_attr or strip_tags to take the things secure, I will lost all the html I use. How I can keep the html tags in place, I just need to add an <i> tag and <p> or <h>, <a> tags. Any suggestion?

Share Improve this question asked Dec 20, 2019 at 11:59 sialfasialfa 32910 silver badges29 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Use wp_kses_post instead! It will keep all the tags allowed in a post, you can also use wp_kses and provide a list of tags and attributes

本文标签: phpSave html content of a widget textarea