How not to allow tags in the database and at the same time to remove the shielding before the quotes in a textarea?

Hello, I'm developing a plugin for Wordpress and I use the tag <textarea></code> in the admin panel. When you add in the database the text with quotes and html tags automatically added shielding and tags of course also do not disappear. The documentation found the function <code class="php">esc_html( $text )</code> and <code class="php">esc_textarea( $text )</code> that do not work in any of my attempts. Tell me how and at what level to use them. Inside the tag <pre><code class="php"><textarea><?php esc_textarea( $text ); ?></textarea> or just when adding to the database. That is, I need to avoid all tags and backslashes in the output
July 2nd 19 at 13:51
2 answers
July 2nd 19 at 13:53
Solution
esc_html / esc_textarea used to display the text in the html / tag (as an attribute for example) or in a textarea, respectively. These functions replace the html symbols (quotes, angular brackets) for character codes to your html code is not broken.

For cutting / encoding of tags / symbols when writing , you must use functions from a set sanitize_*
July 2nd 19 at 13:55
Good evening.
Pay attention to htmlpurifier.org
To process the data before the record should be using mysqli_real_escape_string
In WordPress for these purposes already have everything ready. - Velva.Rogahn commented on July 2nd 19 at 13:58
So why not use? - Dion77 commented on July 2nd 19 at 14:01
: Because the author doesn't know about them, same as you. See my answer. - Velva.Rogahn commented on July 2nd 19 at 14:04

Find more questions by tags WordPressHTML