Start a new topic

How to Add HTML in the category description?

As per the default functionality, we are not able to use any html tags in category description textbox in wordpress admin. WordPress prepared this section for normal content. So, to make it possible, wordpress prepared a filter and put it with all default filters. WordPress placed this filter here :

C:\Users\ASUS\Desktop\wpsitehelpers\filter code.PNG

Sometimes we need html content in the category description section to fulfill our requirement. So, we need to get rid of this default functionality.

Solutions :

There are few plugins available for it, but as per me using a plugin for such small tasks is not a good choice, we can do this by adding a line of code easily. To make this possible we have two approaches :

Wrong Approach :

1. Just open the file “default-filters.php” which exists here : “wp-includes/default-filters.php”.

2. Search for this code :


3. Comment out or remove this code, you are done.

But as the name indicates, it is a wrong approach because we do not recommend any modifications in core files of wordpress. This is a bad practice.

Correct Approach :

As the name indicates, it is a correct approach because here we are not modifying any core file. We just need to put a line of code in our current theme’s functions.php file. This will remove that filter which is responsible to removing these html tags. Put the below mentioned code at the end of your functions.php file :

So, use the correct approach and add above line to your code. Now check, you are able to insert any html tags in your category description section.

Login or Signup to post a comment