Title: Loads wrong language.. sometimes?
Last modified: December 28, 2021

---

# Loads wrong language.. sometimes?

 *  [mtlsam](https://wordpress.org/support/users/mtlsam/)
 * (@mtlsam)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/loads-wrong-language-sometimes/)
 * Okay so this is odd, I’m using Ajax Load More in conjunction with WPML.
 * In my page template I have set the following code:
 *  `<?php if ( ICL_LANGUAGE_CODE==’en’ ) : ?>
    <?php echo do_shortcode(‘[ajax_load_more
   container_type=”ul” post_type=”post” custom_args=”lang:en” category=”teen-health”
   posts_per_page=”4″ repeater=”template_1″ scroll=”true” scroll_distance=”160″ 
   transition=”fade” orderby=”date” order=”DSC”]’); ?> <?php elseif ( ICL_LANGUAGE_CODE
   ==’fr’ ) : ?> <?php echo do_shortcode(‘[ajax_load_more container_type=”ul” post_type
   =”post” custom_args=”lang:fr” category=”sante-des-ados” posts_per_page=”4″ repeater
   =”template_1″ scroll=”true” scroll_distance=”160″ transition=”fade” orderby=”
   date” order=”DSC”]’); ?> <?php endif; ?>`
 * This works, but I’m getting a bug where sometimes the wrong language is displayed
   when using the language switcher, it seemingly doesn’t happen when I just refresh
   the current page. It doesn’t always happen, and seems to happen more when viewing
   in a private browser. There is no caching plugins installed and no server level
   caching as well, I also installed rebusted but that doesn’t help.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Floads-wrong-language-sometimes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [mtlsam](https://wordpress.org/support/users/mtlsam/)
 * (@mtlsam)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/loads-wrong-language-sometimes/#post-15214967)
 * Following up on this for support please. I’m not sure why the code pasted in 
   an ugly manner the first time, so here is a second attempt, it’s the exact same
   code.
 *     ```
       <?php if ( ICL_LANGUAGE_CODE==’en’ ) : ?>
       <?php echo do_shortcode(‘[ajax_load_more container_type=”ul” post_type=”post” custom_args=”lang:en” category=”teen-health” posts_per_page=”4″ repeater=”template_1″ scroll=”true” scroll_distance=”160″ transition=”fade” orderby=”date” order=”DSC”]’); ?>
       <?php elseif ( ICL_LANGUAGE_CODE==’fr’ ) : ?>
       <?php echo do_shortcode(‘[ajax_load_more container_type=”ul” post_type=”post” custom_args=”lang:fr” category=”sante-des-ados” posts_per_page=”4″ repeater=”template_1″ scroll=”true” scroll_distance=”160″ transition=”fade” orderby=”date” order=”DSC”]’); ?>
       <?php endif; ?>
       ```
   
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/loads-wrong-language-sometimes/#post-15236715)
 * [@mtlsam](https://wordpress.org/support/users/mtlsam/) I need to find time to
   set up WPML and run some tests.
    I’m not sure what the problem would be off the
   top of my head.
 *  Thread Starter [mtlsam](https://wordpress.org/support/users/mtlsam/)
 * (@mtlsam)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/loads-wrong-language-sometimes/#post-15237041)
 * Thanks! I’ll await your investigation.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Loads wrong language.. sometimes?’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [mtlsam](https://wordpress.org/support/users/mtlsam/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/loads-wrong-language-sometimes/#post-15237041)
 * Status: not resolved