Skip Navigation

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

Problem:
The client was experiencing an issue where the 'Load More' button on their AJAX-powered page was not loading the fallback language posts when switching to French, despite having the fallback option enabled.

Solution:
We recommended checking if the language cookie support for AJAX was enabled by following this documentation: https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/.
Additionally, we suggested that the client should try duplicating at least one post into the translated category to see if it makes a difference. If the issue persists, we advised the client to follow the instructions provided in a forum topic that addresses a similar problem with wp_query not falling back to the default language: https://wpml.org/forums/topic/wp-query-does-not-fallback-to-the-default-language/page/2/#post-15098171.

Please note that the solution provided might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket with us.

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 7 replies, has 2 voices.

Last updated by Bruno Kos 8 months, 4 weeks ago.

Assisted by: Bruno Kos.

Author Posts
March 6, 2024 at 7:22 am #15377220

vanessaS-12

I have some questions about a wp_query used through an AJAX request

March 6, 2024 at 7:52 am #15377351

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

hidden link

Let me know once you have it all in place or if you have questions related to sandbox.

March 6, 2024 at 8:40 am #15377739

vanessaS-12

I just implemented the same code on the sandbox installation.
So I created on EN a page hidden link and a shortcode in functions.php listing the first 3 posts, with a load more button.

There are 4 whitepaper posts in total, in English, assigned to the category Whitepapers (ID 13).
The category is translated into FR - hidden link with ID 14 (but empty as no french whitepaper posts exist yet)

So just like on my installation, on the EN page hidden link it all works fine - the 4th post gets loaded (after the query args for debugging reasons).

Instead on the FR page hidden link it doesn't.
Again, that [category_name] => livre-blanc arg gets used for the query and therefore I suspect it creates the issue, as that category is indeed empty. It should fallback on the english Whitepaper category.

Let me know if I'm doing something wrong.
Thanks a lot!

March 6, 2024 at 9:33 am #15378134

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Thank you for taking time to set this up, I passed this to our 2nd tier and will get back to you.

March 6, 2024 at 12:36 pm #15379249

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Can you try workaround?
https://wpml.org/forums/topic/categories-not-being-saved-on-gutenberg-editor/page/2/#post-12383631

Perhaps this is the same case, let me know.

March 6, 2024 at 12:49 pm #15379343

vanessaS-12

weirdly enough, I don't have that file in there.

wpml.png
March 6, 2024 at 1:31 pm #15379650

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

I see, I escalated the case to our 2nd tier and will keep you posted.

March 7, 2024 at 1:55 pm #15384698

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Can you try this?
https://wpml.org/forums/topic/wp-query-does-not-fallback-to-the-default-language/page/2/#post-15098171

March 7, 2024 at 2:57 pm #15385079

vanessaS-12

great! that piece of code fixed the issue.
Thanks a lot!