Hi, thanks for the reply,
I have been actually looking inside Polylang code in case I could find an obvious place where that change is done, but I had no success. I am pretty new to PHP and WordPress, so nothing strange about that, I may have been looking at the relevant code without noticing.
I then noticed that wordpress wp_get-archives()
function uses get_archives_link()
to create the link and that a filter hook of the same name could be used to modify the url, so looked for usage info, tried that and seemed to work.
Here goes a rather hackish but apparently working code for this particular case,
// Archives widget still points to ../index.php/$lang/.. link. Remove $lang.
add_filter( 'get_archives_link', 'amd_remove_lang_archives_link');
function amd_remove_lang_archives_link ($html){
// Just in case, don't run on admin side
if ( !is_admin() && function_exists('pll_current_language') ) {
$curlang = pll_current_language();
$html = str_replace( '/index.php/'. $curlang . '/', '/index.php/', $html );
}
return $html;
}
I also noticed a couple of additional issues, adding info about them in case someone finds a workaround.
One minor issue that I find still pending is the recent comments widget, which does not show posts comments when used together with a translated page.
Another issue that I’d expect hard to address is the similar behavior of the search widget. When used together with a translated widget will only look in the translated language, although all posts are in the default language.
Regards,