Skip Navigation

[Resolved] Soma category archives not shown with WPML enabled

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Kirill 4 years, 1 month ago.

Assigned support staff: Nigel.

Author
Posts
#421530

Dear support!

I'm started to translate a site made with Toolset and after I installed and configured WPML everything is working in default language, which is Russian, except for one custom category archive (the slug is 'goods-categories') for a custom post type 'goods'.

Here is a link to one of the category archive pages: hidden link. It shows 'Nothing found' which Views template shows if query returns no items. Debug bar also shows the following error:

Unknown column 't.language_code' in 'where clause'
SELECT SQL_CALC_FOUND_ROWS yms_posts.ID FROM yms_posts INNER JOIN yms_term_relationships ON (yms_posts.ID = yms_term_relationships.object_id) LEFT JOIN yms_posts AS p2 ON (yms_posts.post_parent = p2.ID) WHERE 1=1 AND (
yms_term_relationships.term_taxonomy_id IN (13)
) AND yms_posts.post_type = 'goods' AND (((yms_posts.post_status = 'publish' OR yms_posts.post_status = 'private') OR (yms_posts.post_status = 'inherit' AND (p2.post_status = 'publish' OR p2.post_status = 'private')))) AND ( ( t.language_code = 'ru' AND yms_posts.post_type IN ('post','page','apto_sort','wpcf7_contact_form','sobytiya-reteila','goods' ) ) OR yms_posts.post_type NOT IN ('post','page','apto_sort','wpcf7_contact_form','sobytiya-reteila','goods' ) ) GROUP BY yms_posts.ID ORDER BY yms_posts.post_date DESC LIMIT 0, 20

If I disable WPML, the archive page shows properly.

It's interesting that this custom post type has a second category, 'Producers', and this page is shown properly: hidden link

From the error message it seems that a language code get messed up somewhere in DB tables and this prevents archive view from showing properly. Could you please help me to solve this? It is very important for me.

Thank you in advance!

Best regards,
Kir

#421549

Because fzs-union.ru is a production site, I turned WPML off there to make things working and created a copy of it at hidden link.
The link to a category archive (goods-categories) that is not working is now hidden link
The category archive page that is working (producers) is hidden link
If you need, I can provide you a full access to this site.

#421585

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I think it would be helpful if I could have access to see the queries for both category archives in action, so I will mark your next reply as private.

But, first, could you just check that there is no problem arising from your theme? Switch to a default theme such as twentysixteen and test again, and let me know if this affects the results.

#421741

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Without getting too involved in the details of your site, the first thing I did was to compare your taxonomies (Goods Categories and Producers) to see if there were any differences in the settings.

I noticed that for Goods Categories (which wasn't working) in the options you had "$taxonomy" in the field for $query_var which was blank in the Producers taxonomy options.

Removing that seemed to solve the problem, although I'm not entirely sure why, if you could verify and apply on your live site.

#421767

A very nice catch, Nigel!
Looks like your finding helped to solve the problem completely. The site seems to be working properly now. Don't know why there was this '$taxonomy', but looks like it was causing a wrong behavior. Thank you for your help in fixing this! Excellent job!