Post Categories HTML Being Stripped Out

Hi,

The HTML for paragraphs

is being stripped out of the text in my Post categories. I have followed the suggestion in @rad’s reply in this thread Woocommerce product category title & description

However, the solution does not work and the HTML is still being stripped out. The affected description is being used in a Pro Layout “Archive Description” element.

Do you have any suggestions about how to ensure the HTML comes through?

Thanks,
Christopher

Hi Christopher,

Thanks for reaching out.
I have checked the assigned Post Category page and found the Archive Description is showing fully. Please find the Archive Page URL in the secure note. If that is not the case and you are trying to point out something else, please provide any screenshot marked with the issue or any video that help us to recognize the problem.

Thanks

Hi Tristup,

The description displays, but it does not hold the HTML. @rad had a solution in his response to another query (Woocommerce product category title & description).

I have used the solution, but the HTML is still stripped out. In the screenshot I am sending in the Secure Note there should be an h1 heading and each of the three paragraphs should be within:

<p></p> 

This is what is being stripped out, whilst the h1 tag remains. @rad’s solution is the official WordPress.org solution to re-enabling full HTML is the description field.

Thaks,
Christopher

Hello Christopher,

There are no <p> tags in your description:

I went ahead and edited your description. Kindly test the page now.

Hi Runel,

That is correct. When I went back into the Category editor to view, the <p> tags you had entered, they are no longer there - exactly as your screenshot! It seems you can place them in manually (not through the visual editor), but every time you revisit the editor the manually added <p> tags are removed, despite WordPress’s instructions on how to make changes to functions.php to allow HTML in the description.

Is there anything which can be done to correct this?

Thanks,
Christopher

Hey Christopher,

It wasn’t mentioned in the past that this is not a theme related feature or function so this is beyond the scope of our support to fix.

The last suggestion I’d like you to try is to use 3rd party plugins like this

I just hope that helps. If not, please consult with a developer to create a custom function for you.

Hi Christian,

Thanks for the reply. I tried that plugin. It uses exactly the same code as described by Rad and the WordPress developers, but in plugin form:

foreach ( array( 'pre_term_description' ) as $filter ) {
    remove_filter( $filter, 'wp_filter_kses' );
}
 
foreach ( array( 'term_description' ) as $filter ) {
    remove_filter( $filter, 'wp_kses_data' );
}

It looks like the only solution is to write the descriptions in HTML, save them and not revisit them, to stop the tags being stripped out!

Thanks anyway,
Christopher

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.