qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
558 stars 107 forks source link

Object caching prevents seeing correct category translations when switching to a different language #348

Open herrvigg opened 6 years ago

herrvigg commented 6 years ago

Issue by lemartinet Friday Feb 05, 2016 at 02:45 GMT Originally opened as https://github.com/qTranslate-Team/qtranslate-x/issues/348


Hi ! Thanks for the great plugin. I tried to look into the repo but I could not find a solution to my problem, except some related discussion in #17 . When I activate object caching on my website, if I browse first the french version, and then switch to the english version, the categories are not in the correct language. I've "google-investigated" the problem and it seems to be possible to solve it by adding a key cache_domain in the get_terms args It was solved in WPML : https://wpml.org/forums/topic/get_terms-and-caching-bug/ Polylang : https://wordpress.org/support/topic/taxonomies-mix-up-with-activated-object-cache

I tried to do it by myself, but I have a very limited knowledge of qtranslate-x and caching. I tried adding a filter in my functions.php theme:

function get_terms_args( $args ) {
        global $q_config;
        $lang = $q_config['language'];
        $key = '_' . $lang;
        $args['cache_domain'] = empty( $args['cache_domain'] ) ? 'qtx' . $key : $args['cache_domain'] . $key;
        return $args;
}
add_filter('get_terms_args', 'get_terms_args');

But that doesn't solve the problem... That would be great if you could provide such a patch for qtranslate-x !!

herrvigg commented 6 years ago

Comment by lemartinet Friday Mar 18, 2016 at 07:45 GMT


Hi! Any updates on that particular issue? Thanks for your help! Manu

herrvigg commented 6 years ago

Comment by ahmnabil Wednesday Jul 19, 2017 at 11:51 GMT


hi any update on this issue?