| @@ -7,10 +7,19 @@ | ||
| 7 | 7 | { |
| 8 | 8 | function __construct() |
| 9 | 9 | { |
| 10 | 10 | add_filter('berqwp_page_translation_urls', [$this, 'get_page_translations'], 10, 2); |
| 11 | + add_filter('berqwp_site_url', [$this, 'set_home_url'], 10); | |
| 11 | 12 | } |
| 12 | 13 | |
| 14 | + function set_home_url($home_url) { | |
| 15 | + if (function_exists('pll_home_url')) { | |
| 16 | + return pll_home_url(); | |
| 17 | + } | |
| 18 | + return $home_url; | |
| 19 | + } | |
| 20 | + | |
| 21 | + | |
| 13 | 22 | function get_page_translations($translated_urls, $post_url) |
| 14 | 23 | { |
| 15 | 24 | // 1. Skip if Polylang isn’t active. |
| 16 | 25 | if (!function_exists('pll_get_post')) { |
| @@ -38,5 +47,5 @@ | ||
| 38 | 47 | |
| 39 | 48 | |
| 40 | 49 | } |
| 41 | 50 | |
| 42 | -new berqPolylang(); | |
| 51 | +new berqPolylang(); | |