Support » Fixing WordPress » Enable HTML including <.div>, <.p>, and <.img> in Category Descriptions

  • Hey,

    In wordpress 2.3, How can I enable the ability to use HTML in my category descriptions? I notice I’m able to include links, but if I try to pull an image in, it won’t work.

    Is tehre any way to enable this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter datasta


    bump… anyone know?

    yes… in:

    /wp-includes/default-filters.php around line #60 (at least, in v2.2x) look for:

    //add_filter('pre_category_description', 'wp_filter_kses');

    the // I put in front disables the filter from removing html tags and such in category_description


    Thread Starter datasta


    Hey Sync..

    In 2.3, that line doesn’t exist. I looked. Was it changed to something else?

    well, I’ve not upgraded because of the horrific “everything stops working” posts I’m seeing in the forum…

    1) maybe they are allowing html in the category description now (not filtering)
    2) Maybe you just aren’t calling the image properly so it simply doesn’t display?
    3) does the link reference stay in the content of the description and the html to display the image is removed when you revisit that category via Manage>Category by clicking the Edit link?

    I guess I’m asking if you think it’s not working because it actually removes what you put in the category description FIELD or you think it isn’t working because the image doesn’t show up.

    Just trying to help. Stripping of HTML in 2.2x annoyed the hell out of me until I fixed it using my suggestion above. As I said, I’ve been reluctant to upgrade just due to large number of wtf? posts about 2.3

    Thread Starter datasta


    If I add in a Category description using HTML it removes all html, like <img src and div tags, but it leaves in the URL stuff like a href

    Thread Starter datasta


    Does anyone else know anything about this?

    Thread Starter datasta


    I guess this will be my last chance to figure this out.

    If anyone could tell me how to display full on HTML in a category description in wordpress 2.3 it would be greatly appreciated.


    The post above is still accurate as far as the file goes, but the content has changed a bit for 2.3. You’re looking for this section around line 14:

    // Kses only for textarea saves

    $filters = array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description');
    foreach ( $filters as $filter ) {
    	add_filter($filter, 'wp_filter_kses');

    Comment out the add_filter line and you’re set.

    Alternatively, you could create a category template for that specific category, get the text content of the description out via:
    <?php echo category_description($cat);
    and put your images in your category template.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Enable HTML including <.div>, <.p>, and <.img> in Category Descriptions’ is closed to new replies.