This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 14 replies, has 3 voices.

Last updated by Andrey 11 months, 2 weeks ago.

Assigned support staff: Andrey.

Author Posts
March 1, 2018 at 12:06 pm #1533044


In WooCommerce Multilingual -> Categories -> Category Translation, I click "Copy to all languages" (Or I click the Edit icon to get the pop up), and after it copies, the languages it has copied to do not have the HTML we included. It may be occurring during the save process because in the pop up I can see HTML initially, but after Saving it and clicking the pop up again, or editing the category, all the HTML is all stripped.

March 1, 2018 at 12:17 pm #1533063


If I edit the foreign language category direct, after translating it, to copy and paste the HTML, and click Update, that also strips it out, so it may not be the copy to language function. But saving the description with HTML in the default language works OK.

March 1, 2018 at 12:32 pm #1533082


Worse still, if I use Copy to all languages, it then strips the HTML in the default language I am copying from!

March 1, 2018 at 12:35 pm #1533088


The issue is reported here

If I implement the WPML core code change, then it half works. Copy to all languages is stripping some HTML (bullets) but leaving some others (links), and still does the same stripping to the default language, but then I can save the foreign version HTML. This is not a solution of course.

So you have a bug in your code, you are stripping HTML, whereas the expected behaviour is to duplicate the full content how we want it.

How long do you take to fix bugs, I cant wait long to do this. We've purchased the product, but its not useable, our foreign category pages are all broke, we cant go live with the foreign languages.

March 1, 2018 at 1:02 pm #1533115


It seems the only way to get this to work is two things...

1) Use this plugin, AND
2) Hack your code to $description = $_POST['description'];

If I only use the Visual Term plugin, then it does not work at all.
If I only implement the hack in your core code, then some HTML is copied, bullets are stripped

If I use both, then the exact same HTML is copied.

This means we will have to exclude WPML updates until this bug is fixed.

P.S. Also when I copied categories they're all in the wrong order. I did "synchronise hierarchy". But thats another issue I will raise, I wasted enough time trying to fix this issue!

March 1, 2018 at 1:06 pm #1533120


The translation has now added -2 on the end of every category?? So instead of the expected travel-systems-fr/ I see travel-systems-fr-2/. So I now I have to manually edit everyone to remove the -2

March 1, 2018 at 1:16 pm #1533132


And during the process it has not updated hard coded links which are in each category description, so they need changing too.

March 1, 2018 at 6:54 pm #1533615


Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting us.

I saw what you're reporting. In fact, this is how WordPress works. I tested this without any plugin enabled and with WooCommerce enabled. Both strip tags in the description taxonomies.

The Visual Term plugin removes the filter to sanitize within the visual-term-description-editor/php/class-editor.php:44 and 45.

Our developers are aware of this, but at the moment, only the workaround you are using will solve this compatibility issue.

I'm going to add your ticket to our developers.

Thank you.

March 2, 2018 at 10:19 am #1534137


I am not sure its the way WordPress works. We can save the WYSIWYG editor HTML OK in in the default language, and before WPML was installed. Other sites we have have the WYSIWYG editor in categories. I have just checked 3 other sites, they all have a WYSIWYG. I added a heading, bullets and hyperlink and they all saved fine. This was in the description of WP categories, AND WooCommerce categories. Even a site without WooCommerce using the Posts categories. We have not added any special plugin to add that WYSIWYG. So WordPress by default does look like its adding in a WYSIWYG therefore allowing HTML to be added. I only get this issue below when using WPML to duplicate it.

March 2, 2018 at 12:28 pm #1534305


Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

You can only save the HTML inside the description because as I posted above, the plugin you are using, Visual Term, for example, or any other plugin that allows this, is changing the default behavior of WordPress.

You can see more in the WooCommerce official documentation, which shows a piece of code to change this behavior in WordPress:

That is, natively WordPress should not allow this unless a plugin or custom coding - as posted in the WooCommerce documentation, is used.

Using the workaround of the other topic and the code that is available on the official WooCommerce website, this may work correctly.

Note that I have already reported this to our developers.

Thank you.

March 5, 2018 at 12:39 pm #1536216


"You can only save the HTML inside the description because as I posted above, the plugin you are using, Visual Term, for example, or any other plugin that allows this, is changing the default behavior of WordPress."

Then WordPress must have recently change this, because I can use the WYSIWYG in several of my WordPress sites, without Visual Term installed, and with or without WooCommerce. I can add and save HTML fine in my WordPress which is the latest version of WordPress at time of writing this.

May 31, 2019 at 10:17 am #3929719


Hi. this is quite an old issue, but its still open. So I wanted to ask if WPML have addressed this issue in subsequent updates? Can we stop using the plugins and hack to get the HTML to copy in categories?

May 31, 2019 at 9:06 pm #3933277


Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)


This is still in our to-do list, but we do not have a deadline of when or if this will be added in future versions of WPML.

The suggestion of the 2nd tier support was this:

The client can change the line:

$description = filter_var( $_POST['description'], FILTER_SANITIZE_STRING );

in \wp-content\plugins\sitepress-multilingual-cms\inc\wpml-post-edit-ajax.class.php to

$description = $_POST['description'];

and thus bypassing any sanitization for this - but I don't recommend it.

Note that at the moment, we do not have any hooks to make this more permanent and we should not change this in future versions of WPML. You can test the above steps, but this is not recommended.

Thank you.

June 3, 2019 at 9:39 am #3940935


Are you saying WPML does not recommend use HTML in other language category descriptions? Because thats what you imply by not recommending the above solution or implementing it. And that quite frankly is ridiculous to not support HTML in category descriptions.

June 18, 2019 at 5:39 pm #4045557


Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+03:00)

Hi, it's me again. I took over this ticket to be better of help. Let me recap about the problem we are trying to solve here.

By default WordPress allows to save the following tags in the term description: a, br, em, strong;

I ran quick tests with latest WP 5.2.1, WC only and by default, I'm not able to save the tags like you showed <span></span> on the screenshot. So that WPML doesn't keep them too.

As far as I can see, you are using the plugin to overcome this (it's Visual Term Description Editor plugin). You also may see the following when you add the term description below the text area: "The description is not prominent by default; however, some themes may show it."

Since it is not expected, I'll clarify this further if this is going to be changed or not.

In the meantime, I was able to save the HTML in the term description if going to Products >> Categories, switch to the translated language and save (not using category translation feature in WCML). Have you tried this way?

The topic ‘[Closed] WPML WooCommerce "Category Translation" not copying html’ is closed to new replies.