If your site uses WPML and you have enabled AJAX for pagination, “load more” buttons or ajax filtering, you may notice that the loaded results are in the wrong language.
Symptoms
- The first batch of posts displays correctly in the current language, but clicking Load More or a pagination link appends posts from the default language (or from all languages at once).
- Filter buttons return no results, or return results from the default language, even though translated posts and terms exist.
- The issue only affects logged-out visitors. When you are logged into WordPress, everything looks correct.
- The problem often appears (or gets worse) after enabling a caching plugin.
If that last point sounds familiar, you are almost certainly hitting the issue described below.
Why This Happens
WPML normally determines the current language from the URL, for example /es/blog/ or ?lang=es. AJAX requests do not use that URL. They are sent to admin-ajax.php (or a REST endpoint), which has no language information attached to it, so WPML falls back to the site’s default language and returns the wrong posts.
To solve this, WPML stores the visitor’s language in a cookie that it can read during AJAX requests. This behaviour is controlled by a setting in WPML, and if that setting is off, any AJAX-driven query will run against the wrong language. That includes Total’s load more and filtering.
The Fix: Enable the WPML Language Cookie
Follow these steps to fix the issue:
- Go to WPML → Languages.
- Scroll down to the Language filtering for AJAX operations section.
- Check the option Store a language cookie to support language filtering for AJAX.
- Save your settings.
- Clear any caches, both your caching plugin and your browser.
- Reload the page and test the load more or filter again.
For the full details and a screenshot of the setting, see WPML’s own documentation: Enabling a Language Cookie to Support AJAX Filtering
What the setting actually does
Once enabled, WPML sets the language cookie using JavaScript so it can return the correct content for AJAX operations. It behaves differently depending on the visitor:
- Logged-in users: nothing changes. The setting is not applied and the language cookie is saved normally using PHP.
- Logged-out users: WPML sets the cookie with JavaScript, which means the correct language can still be detected on a cached site.
This is exactly why the problem so often shows up only for visitors and not for you as an administrator.
Still Not Working?
If the setting is enabled and results are still coming back in the wrong language, work through the following:
- Purge every layer of cache: Your caching plugin, any server-level cache (Varnish, LiteSpeed, NGINX FastCGI), and your CDN. Old cached HTML can keep serving stale AJAX URLs.
- Check that your cache is not stripping cookies: Some aggressive configurations remove or ignore cookies for anonymous visitors, which prevents WPML from reading the language. If you can, exclude the WPML language cookie (
_icl_current_language) from being stripped. - Check your cookie consent or GDPR plugin: Many consent plugins block cookies, and the scripts that set them, until the visitor accepts. Because WPML sets this cookie with JavaScript, a consent plugin can stop it from ever being written. Check whether the plugin has categorised the WPML language cookie as non-essential and, if so, reclassify it as necessary or functional. Remember that visitors who decline optional cookies will still hit the problem unless the cookie is treated as necessary.
- Confirm the content is actually translated: Load more and filtering can only return posts, pages and terms that exist in the current language. Untranslated posts will not appear, which can look identical to a language bug.
- Check your taxonomy translations: If you are filtering by category or a custom taxonomy, the terms themselves must be translated in WPML → Taxonomy Translation, not just the posts.
- Test with caching disabled: If it works with your caching plugin off, the problem is in your cache configuration rather than in WPML or the theme.
- Test with a default theme and only WPML active: This rules out a conflict with a third-party plugin that modifies the main query.
One caveat worth knowing: if you find this cookie setting interferes with your caching plugin, WPML allows you to disable it again from the same screen. In that case you will need to work with your host or caching plugin support to allow the cookie, since disabling it will bring the AJAX language problem straight back.
WPML Resources
If you have enabled the language cookie, cleared your caches, and AJAX results are still returning the wrong language, the next step is to contact WPML support. The language cookie and how it interacts with your caching and consent setup are handled by WPML, so their team is best placed to diagnose it.
If the problem happens only with Total’s elements and translated content loads correctly everywhere else on the site, open a ticket with us instead and include a link to the affected page along with details of which element is being used.