Conversation
supportI am presenting an error that only occurs in the search results page, it turns out that when wanting to change the language it adds “http: // store //” at the beginning of the URL, breaking everything. Please I need help. Thanks The page I need help with: [ log in to see the link]
Hi, I also encountered that error and fixed it with this hack: // fix an error introduced by woo-poly-integration in Pages::translateShopUrl() // @see issue link https://github.com/hyyan/woo-poly-integration/issues/566 add_filter('pll_get_archive_url', 'fix_language_switcher_url_error_1', 9, 2); add_filter('pll_get_archive_url', 'fix_language_switcher_url_error_2', 11, 2); function fix_language_switcher_url_error_1($url, $language){ global $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK = $url; return $url; } function fix_language_switcher_url_error_2($url, $language){ global $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; if(is_search()){ $domain = get_option('siteurl'); if(stripos($url, $domain)===false){ $url = $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; } } return $url; } Also opened an issue on github: link https://github.com/hyyan/woo-poly-integration/issues/566 This reply was modified 4 years, 6 months ago by Andreas Münch .
Hi, I also encountered that error and fixed it with this hack: // fix an error introduced by woo-poly-integration in Pages::translateShopUrl() // @see issue link https://github.com/hyyan/woo-poly-integration/issues/566 add_filter('pll_get_archive_url', 'fix_language_switcher_url_error_1', 9, 2); add_filter('pll_get_archive_url', 'fix_language_switcher_url_error_2', 11, 2); function fix_language_switcher_url_error_1($url, $language){ global $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK = $url; return $url; } function fix_language_switcher_url_error_2($url, $language){ global $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; if(is_search()){ $domain = get_option('siteurl'); if(stripos($url, $domain)===false){ $url = $ARCHIVE_URL_BEFORE_WOO_POLY_HOOK; } } return $url; } Also opened an issue on github: link https://github.com/hyyan/woo-poly-integration/issues/566 This reply was modified 4 years, 6 months ago by Andreas Münch .