• Hello All,

    I’ve been using Polylang for some time with great results, but i’m currently having a bit of trouble with a custom theme i’ve created.

    What happens is that in one page i have a list of posts that’s obtained through a custom query via AJAX (one of the requirements of the theme is that the filters applied to the query are applied without reloading the page) the posts are loaded correctly, but if i open one of those posts on a separate tab and change the selected language, if i apply the filter again on the first tab, the query will result in the posts being the other language.

    As far as i can tell, this is caused by the ‘pll_language’ cookie.
    I have tried to disable it using
    define(‘PLL_COOKIE’, false);

    But that just breaks the language functionality on the entire website.
    I’ve also tried to send the language parameter to the query with the AJAX request ( And also while using “supress_filters = true”, but that also does not seem to work.

    At the moment i’m using javascript to force every page load to set the pll_language cookie the same language as the html ‘lang’ attribute (and also with each AJAX request), but i’m not sure if this will be enough to make this behaviour stop.

    Any ideas if there is a more bullet proof way of getting this to work?

    [ Please do not bump. ]

  • The topic ‘Navigation in Multiple tabs breaks AJAX query’ is closed to new replies.