Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're using the JetSearch plugin to filter blog posts and it's working fine for the default language but showing non-translated content for other languages, we have a solution for you.
Solution:
First, ensure you have a complete backup of your database and website. Then, apply the following workaround:

1. Edit the file

/wp-content/plugins/jet-search/includes/ajax-handlers.php

. Around line 61, below the code:

public function init() {

Add this code:

//WPML workaround for compsupp-6886 - Part I
if ( isset( $_GET[ 'wpml_lang' ] ) ) {
    do_action( 'wpml_switch_language',  $_GET[ 'wpml_lang' ] ); // switch the content language
}

2. Edit the file

/wp-content/plugins/jet-search/includes/assets.php

. Around line 165, below the code:

this->localize_data = apply_filters( 'jet-ajax-search/assets/localize-data', $this->localize_data );

Add this code:

//WPML workaround for compsupp-6886 - Part II
$wpml_current_lang = apply_filters( 'wpml_current_language', NULL ); 
if ( $wpml_current_lang ) {
    $this->localize_data['rest_api_url'] = add_query_arg( 'wpml_lang', $wpml_current_lang, $this->localize_data['rest_api_url'] );
}

After making these changes, check the issue on the frontend again. For more details, refer to our documentation on debugging theme compatibility.

Additionally, it's worth noting that this issue should have been resolved with JetSearch version 3.2.0.

If this solution doesn't seem relevant to your situation, please don't hesitate to open a new support ticket with us here.

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.

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by Long Nguyen 1 year, 7 months ago.

Assisted by: Long Nguyen.

Author Posts
July 12, 2023 at 7:52 am #14020087

peterM-129

Hi,

Using the Jet Smart Filter plugin to filter the blog posts. It's working fine for the default language. But showing non-translated content for all other languages.

hidden link
hidden link
hidden link

July 12, 2023 at 8:47 am #14020837

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Peter,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

According to the Debug info, I the Posts translation preference is "Translatable - use translation if available or fallback to default language" in WPML > Settings > Post Types Translation.

Please try to:
- Set the preference to "Translatable - only show translated items".
- Or translate the post to second language.
then let me know how it goes.

Look forward to your reply.
Thanks

July 12, 2023 at 4:54 pm #14027277

peterM-129

Updated the settings, and also tested a translated post. but it's still same.

July 13, 2023 at 2:17 am #14028719

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated. Your next reply is set to private to share the info.

❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: 
https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme and to change configurations on the site if needed. This is also a reason the backup is critical.

Look forward to your reply.
Thanks

July 17, 2023 at 2:59 am #14045569

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

After checking your site, I see none of two suggested solutions above applied on your site
https://wpml.org/forums/topic/jet-smart-filter-urls-are-not-translated-in-filtered-content/#post-14020837

- Posts translation preference is still set to "Translatable - use translation if available or fallback to default language" in WPML > Settings, please check the screenshot hidden link

- The posts are not translated into second languages, please check the screenshot hidden link

Then I set the Posts translation preference to "Translatable - only show translated items" and it fixes the issue. Can you please confirm it works on your site?

Look forward to your reply.
Thanks

July 17, 2023 at 11:44 am #14048905

peterM-129

Hi,

I applied the translation on only one post for one language (SA).
hidden link

But its not working for SA (South Africa) language, as you can see in the video hidden link

July 18, 2023 at 11:37 am #14058781

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

As in your screen record (from second 41), you can see the text "Add translation to South Africa". That means the post is not translated into South Africa language. You can also edit the post and check the translation in the Language box, please see this screenshot hidden link

The post "5 Ways to Cut Down Admin Time With Job Management Hacks" is only translated into Canada language and it is available on the Blog page in Canada language.
hidden link

I hope that makes sense.

July 19, 2023 at 5:09 am #14062499

peterM-129

Hi Long Nguyen, I think you did not get my point, the issue is that the filtered posts links are not translated.
You are right that the "5 Ways to Cut Down Admin Time With Job Management Hacks" post is only translated in Canadian language. so now to recreate the issue we are facing, please follow the steps below.

1. go to hidden link
2. search for "5 Ways to Cut Down Admin..." in the search box hidden link
3. click on "5 Ways to Cut Down Admin Time With Job Management Hacks" post from the search results.
4. it will take you to the default language hidden link instead of the Canada version.

We want translated links in the search results.

Same issue if you try the "Categories" filter.

I hope that makes sense.

July 19, 2023 at 7:36 am #14062863

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

The filter by categories displays the post in the Canada language correctly, just the results in the search form do not display the post in the Canada language. Please check this screenshot hidden link

The search form is created by the plugin JetSearch, so can you please help me to replicate the issue on a clean installation of WordPress? You can access the WordPress dashboard using the link below:
hidden link

Kindly follow the steps below:

- Don’t restore your site there.
- Install the JetSearch plugin.
- Try to replicate the issue.
- Then let me know the steps to replicate it.

Look forward to your reply.
Thanks

July 19, 2023 at 10:38 am #14065141

peterM-129

ok, updated the sandbox link. please test only for Zulu (SA) language.

hidden link

the search result should be linked to Zulu (SA) version of the post. but it's linked to the default language.

July 20, 2023 at 3:22 am #14069045

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I see the issue happens in the preview results box only, if you click on "See all results" and the translation post is displayed correctly there.

I'm asking our 2nd tier support about this issue and update you here when I have something to share. Meanwhile, please try to contact the plugin JetSearch author and ask them about this issue if they are aware of this.

Thanks for your patience.

July 25, 2023 at 3:58 am #14092901

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got a workaround from our 2nd tier support to fix this issue, please check it below:

1. IMPORTANT: Please backup your database and website before proceeding.

2. Edit the file /wp-content/plugins/jet-search/includes/ajax-handlers.php, around line 61, below the code

public function init() {

add this code

//WPML workaround for compsupp-6886 - Part I
if ( isset( $_GET[ 'wpml_lang' ] ) ) {
    do_action( 'wpml_switch_language',  $_GET[ 'wpml_lang' ] ); // switch the content language
}

3. Edit the file /wp-content/plugins/jet-search/includes/assets.php, around line 165, below the code

$this->localize_data = apply_filters( 'jet-ajax-search/assets/localize-data', $this->localize_data );

add this code

//WPML workaround for compsupp-6886 - Part II
$wpml_current_lang = apply_filters( 'wpml_current_language', NULL ); 
if ( $wpml_current_lang ) {
	$this->localize_data['rest_api_url'] = add_query_arg( 'wpml_lang', $wpml_current_lang, $this->localize_data['rest_api_url'] );
}

Save changes and check the issue in the frontend again. Refer to the documentation https://wpml.org/documentation/support/debugging-theme-compatibility/#issue-custom-non-standard-wordpress-ajax-requests-always-return-the-default-language-content

Look forward to your reply.
Thanks

November 24, 2023 at 2:59 am #14913113

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

FYI, this issue should have been solved with JetSearch 3.2.0.

Have a good day