• Resolved rh3sus

    (@rh3sus)


    I have a site that I started building on version 2.8 that relies heavily on custom taxonomies.

    I need to use html in my term descriptions for adding pictures e.t.c.

    In 2.8 I added
    remove_filter( 'pre_term_description', 'wp_filter_kses' ); in my functions.php which enabled html in the term descriptions.
    Since upgrading to 2.9 this no longer works, and html is filtered out of the descriptions on display (it is still saved in the editor).

    I have a feeling this may have something to do with

    Add a ‘the_terms’ filter

    or

    # Filter fields through kses upon display and introduce sanitize_user_object() and sanitize_user_field()

    mentioned in the 2.9 Codex but don’t know how I can override this.

    So, does anyone know how I can enable html in term descriptions as of 2.9?
    Many thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter rh3sus

    (@rh3sus)

    I’ve updated to 2.9.1 and the problem still persists. Anyone?

    I’m having the same problem. Hate it when “upgrades” break my website.

    Think this may involve some of the deprecated things in /wp-includes/deprecated.php

    Thread Starter rh3sus

    (@rh3sus)

    Think this may involve some of the deprecated things in /wp-includes/deprecated.php

    Not a bad idea, but I just read through that file and could not find any functions relating to filtering of content in this way.
    I’m going to start grepping through all the files in 2.9.1 now to see what I can find that might relate to this.

    Thread Starter rh3sus

    (@rh3sus)

    I looked for the the_terms filter that I mentioned in my first post but that is only for displaying terms in a list so it doesn’t seem like it is related to term descriptions.

    I think it might be something in wp-includes/default-filters.php

    Thread Starter rh3sus

    (@rh3sus)

    Ok, I have found it.

    I added remove_filter( 'term_description', 'wp_kses_data' ); to my functions.php and images are now displayed again.

    [stop reading here and just apply the above if you don’t want the geeky explanation]

    Turns out (I think) that it has been changed so that wp_filter_kses is for filtering when you save the description in wp-admin and wp_kses_data has been added to filter on display of the page, so you will need both the remove_filter lines in your themes functions.php

    The functions run through $allowedtags in wp-includes/kses.php so an alternative would be to add ‘img’, ‘src’ e.t.c to the allowed tags list, which would enable you still filter but let images and whatever allowed tags you add through. This explains why links still worked – ‘a’ and ‘href’ are allowed tags by default. While this would allow you to still filter other stuff in the post out, you would have to make the change to kses.php after every wordpress update.

    Thread Starter rh3sus

    (@rh3sus)

    quirk please confirm if this works for you too and i’ll mark the thread as resolved.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Enable XHTML in term descriptions’ is closed to new replies.