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:


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:


So the end result (in terms of the material that appears above the header) looks like this:

enter image description here

Other than that, in the place where the description should appear (under the title), everything renders properly, including the hyperlinks, so that it looks like this:

enter image description here

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

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

I have also tried similar solutions, such as the "HTML in Category Descriptions" plugin, and the following code, which addresses the other filters that are at play here, but nothing works:

function disable_kses() {
    foreach (array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description') as $filter) {
            remove_filter($filter, 'wp_filter_kses');

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

  • there are more filters involved in the term description; check stackoverflow.com/questions/31169894/…
    – Michael
    Jul 19 '20 at 16:34
  • @Michael updated my question to reflect this. Addressing those filters doesn't seem to make a difference, at least the way I'm doing it.
    – Thredolsen
    Jul 20 '20 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.