Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when WPML uses GET param as lang format #12

Open
luzel opened this issue Feb 25, 2018 · 4 comments
Open

when WPML uses GET param as lang format #12

luzel opened this issue Feb 25, 2018 · 4 comments

Comments

@luzel
Copy link

luzel commented Feb 25, 2018

Wordpress 4.9.1 (multisite)
Timber 1.5.2

When WPML language URL format is "Language name added as a parameter" there is issue with calculating base_path in method Routes::map(). Function get_bloginfo('url') returns URL containg "?lang=en" which ends up with wrong base_path (I am not sure but maybe this is bug beacuse of multisite)

Fix on forked github repo:
https://github.com/luzel/routes

@Part-A
Copy link

Part-A commented Jul 24, 2018

This issue is not limited to multisite - it is apparent for single site, using WPML, timber and routes installed via composer (not plugin version).

Even when the lang is in the url (www.afakeurl.com/us/) routing via Routes is broken - this may be due to WPML incorrectly adding a '/' to the url returned by get_bloginfo('url'). Luzel's fix works in this situation too as it removes the '/'.

It would make sense to include Luzel's fix, or some version of, in Upstatement/routes.

@stevecomrie
Copy link

stevecomrie commented Aug 3, 2018

Pretty sure I'm running into either this exact bug or a variation of it.

In the Routes::map() function the $base_path variable used in the setBasePath() function used to always be something like: "/" or "/lang/", but some where in an update (maybe with WPML), I started getting a $base_path value of: "/lang//".

I was able to fix this with a simple:

$base_path = str_replace( "//", "/", $base_path );

Right before:

$upstatement_routes->router->setBasePath($base_path);

I don't like modifying the local version of Routes.php, so hopefully a fix will be incoming soon for this.

@n3storm
Copy link

n3storm commented Oct 23, 2019

Same happens to me. I made a more elaborate fix only replacing double dash "//" if is found.

A proper fix would be great.

@jarednova
Copy link
Member

@n3storm @stevecomrie. Thanks for the nudge, sorry I missed this last year. Just pushed #12 to resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants