Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Fall back to $polylang->pref_lang for AJAX endpoint URL when $polylan…
Browse files Browse the repository at this point in the history
…g->curlang is not available.
  • Loading branch information
gonzomir committed Oct 2, 2018
1 parent 29f4895 commit 5a7fc8d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Hyyan/WPI/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function __construct()
public function filter_woocommerce_ajax_get_endpoint($url, $request)
{
global $polylang;
return parse_url($polylang->filters_links->links->get_home_url($polylang->curlang), PHP_URL_PATH) . '?' . parse_url($url, PHP_URL_QUERY);
$lang = ( $polylang->curlang ) ? $polylang->curlang : $polylang->pref_lang;
return parse_url($polylang->filters_links->links->get_home_url($lang), PHP_URL_PATH) . '?' . parse_url($url, PHP_URL_QUERY);
}
}

0 comments on commit 5a7fc8d

Please sign in to comment.