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 thread is resolved. Here is a description of the problem and solution.

Problem:
I have enable a Product Categories - Grid Settings on my home page. I have set the section as I prefered and then I have enable WPML. This changed the ordering of my categories from default (as I selected them) to alphabetical ordering.

Solution:
It seems that get_terms does not respect order of passed elements in the include directive when using WPML. For now, a temporary fix is to go to the wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering folder and open the class-wpml-term-query-filter.php file. Once you did this, just simply change this code from line 175:

"SELECT taxonomy, term_id FROM {$this->wpdb->term_taxonomy}
             WHERE term_id IN (" . wpml_prepare_in( $ids, '%d' ) . ")"

to

"SELECT taxonomy, term_id FROM {$this->wpdb->term_taxonomy}
WHERE term_id IN (" . wpml_prepare_in( $ids, '%d' ) . ")
ORDER BY FIELD(term_id, (" . wpml_prepare_in( $ids, '%d' ) . "))"

This topic contains 49 replies, has 2 voices.

Last updated by Radu 1 month, 4 weeks ago.

Assigned support staff: Radu.

Author Posts
August 20, 2019 at 9:35 am #4422177

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

As I know, the French language was added recently, am I right? I just want to know that to see if there's any connection.

Can you create a new duplicator package so I can create a copy of the website and have a look, please? If needed, I'll pass it to my colleagues on the thread already opened about this to see if there's anything we need to change on the code I send to you.

Thanks,
Radu

August 21, 2019 at 9:04 am #4429255

dimitriosM-2

Hey Radu,

France has been added recently, yes. I have spotted another issue on English too. The second plugin with the categories is not displayed on home page. I don't know if we can connect it somehow with entire language issue.

Thank you very much

August 22, 2019 at 8:32 am #4437491

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

I tried to use the credentials you send to me but I get a message that the username or password is incorrect. Can you check them, please?

The next reply is set to be private so you can safely send me the credentials.

Thanks,
Radu

August 23, 2019 at 9:47 am #4445743

dimitriosM-2

Good day Radu,

I have spot the issue of the product categories after the last change of the code that your support team send me to add. The home pages were duplicated so the kept the first language categoryid. I set the categories again on each page and it works fine now!

Thank you very much for your assistance and your time.
My best wishes to you and your team!

August 23, 2019 at 9:55 am #4445759

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

I'm really happy to hear that everything works fine now. Well done!

I will mark this ticket as resolved now (since we managed to fix this using a small change in the code). The issue in our list will stay the same (open) so that my colleagues can fix it for good inside the plugin and make sure that it won't happen again.

Wish you a great weekend,
Radu