• Hello,

    When I do a search on my site https://www.tagtom.com, the results are in the correct language, but the page always reverts to the default language (French).

    I adapted some code on the searchform.php but it doesn’t seem to help:

    <?php
    $currentlang = get_bloginfo('language');
    if ( $currentlang=="en-CA" ) {
      echo "<h2>Search</h2>";
      echo '<form method="get" id="searchform" action="' . site_url() . '/en/">';
    }
    else {
      echo "<h2>Recherche</h2>";
      echo '<form method="get" id="searchform" action="' . site_url() .'/">';
    }
    ?>

    I also tried :

    <?php
    
     if(function_exists('pll_current_language')){
        $current_language = pll_current_language();
      $default_language = pll_default_language();
      if($current_language != $default_language){
          $language_subdir = $current_language.'/';
        } else {
          $language_subdir = '';
      }
    }
    ?>

    Any suggestions? By the way, my URLs are determined by language directory name.

    Thanks in advance,

    Stephan

    https://www.ads-software.com/plugins/polylang/

  • The topic ‘Search results page reverts de default language’ is closed to new replies.