Skip Navigation

[Resolved] Filtering a view by taxonomy in multilangual website

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by nabils 6 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#605214

Hi,
I have a website in 2 languages (I am using wpml), English and Arabic. I have a main custom type called Training which is linked to a taxonomy Expertise. I translated all value of the expertise. I created all my Trainings from the Arabic website, then I created a view with search filter in the English website and another search view in the English one. I made Arabic posts visible from both websites using:
function wpml_custom_query( $query ) {
$query->query_vars['suppress_filters'] = true;
}
add_action( 'pre_get_posts', 'wpml_custom_query' );
My objective is to search (from the view) for trainings from the any website based on the expertise. All works fine from the Arabic website. From the English website, if I search by keyword, or any other custom field it works, but not if I search by expertise. Do you have any clue please?
I even tried to give the save value to the slug of each expertise in both languages, but in vain.

#605330

Dear Nabils,

Are we talking about a custom codes problem? The custom codes you mentioned above will take effect on all wordpress query, see wordpress document:
https://developer.wordpress.org/reference/hooks/pre_get_posts/
Fires after the query variable object is created, but before the actual query is run.

It will conduct some unexpected result, please try these:
1) Disable the custom codes you mentioned above
2) Deactivate other plugins and switch to wordpress default theme, and test again

#606059

Thank you for the suggestion. I ended up changing the taxonomy by a checkboxes field and it works.

#606060

I close this ticket then