How to remove html tags clearing from description in wp_insert_term

Admin WordPress Discuss

When you use wp_insert_term it removes any html tags in description. But what to do when they are needed?

Example

This description:

<p style="text-align: center;">content</p>

In function wp_insert_term() will be:

<p>content</p>

How to fix

You need use pre_insert_term

Before function wp_insert_term() insert:

remove_filter('pre_term_description', 'wp_filter_kses');

Hi! You are on my site. I am a developer. Here I share my knowledge. Ask in the comments if you don’t understand something or write if you have something to add.

Leave a Reply

Write your comment if you have something on the topic of the current article:
"How to remove html tags clearing from description in wp_insert_term"
If you need to add a piece of code put it between the tags <code></code>