How to enable HTML tags in category description without breaking the category page

Question

I’m trying to include hyperlinks as part of the description on a category page.

Since WordPress strips the necessary HTML tags, I’ve added the following PHP code in a plugin, which stops the HTML tags from getting stripped:

add_action('init','disable_kses');

function disable_kses() {
    remove_filter('pre_term_description', 'wp_filter_kses');
    }

This lets me include HTML tags fine, but when I include a hyperlink in the description, it breaks the page in a weird way, with material from the description being reproduced above the header. This includes all the text from the first hyperlink until the end of the description, but the first link itself isn’t reproduced (only the text for it is). In addition, at the very end of the material, the following is appended to the text:

“>

Other than that, in the place where the description should appear (under the title), everything renders properly, including the hyperlinks.

The HTML that I use to include the hyperlinks is standard:

<a href="http://example.org/">example</a>

My question is what should I be doing differently in order to be able to include hyperlinks as part of the category page description?

0
, , , Thredolsen 4 months 0 Answers 59 views 0

Leave an answer