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

Language menu-item return site_url instead of home_url #247

Closed
ptrckvzn opened this Issue Dec 16, 2016 · 3 comments

Comments

2 participants
@ptrckvzn

ptrckvzn commented Dec 16, 2016

Version Information

  • WordPress: 4.7
  • MultilingualPress: 2.4.8

Steps to Reproduce

  1. Create a multisite installation with WordPress in subfolder /wp
  2. Define WP_HOME to example.com and WP_SITEURL to example.com/wp in PHP config
  3. Add 2 blogs (main + 1) with a menu with a language menu-item pointing to the translation
  4. On second blog's front page, check the returned site_url for main blog

What I Expected

I am expecting it to return home_url (example.com).

What Happened Instead

On main blog, the language menu item return proper front-page site url for other blog translation. But, on second blog, the language menu item returned for front-page of main blog is site_url (example.com/wp).

I was able to fix this by changing get_site_url to get_home_url here

Is this the proper behavior? Should the url returned be home_url instead of site_url?

Notes

I am using Roots' project structure Bedrock

@ptrckvzn

This comment has been minimized.

Show comment
Hide comment
@ptrckvzn

ptrckvzn Dec 21, 2016

Hello, I just noticed that the error reported here happens when main blog is set to a static front-page and the second blog is set to 'latest posts'. After setting both with a static front-page, both front-page returned are OK in the language nav item. So, I don't know if this is worth investigating further as most installation will have the same settings (static vs latest posts) for the front-page. If I can be of further help, I'd be more than happy to report back here.

ptrckvzn commented Dec 21, 2016

Hello, I just noticed that the error reported here happens when main blog is set to a static front-page and the second blog is set to 'latest posts'. After setting both with a static front-page, both front-page returned are OK in the language nav item. So, I don't know if this is worth investigating further as most installation will have the same settings (static vs latest posts) for the front-page. If I can be of further help, I'd be more than happy to report back here.

@tfrommen tfrommen added this to the v2.4.9 milestone Dec 22, 2016

@tfrommen

This comment has been minimized.

Show comment
Hide comment
@tfrommen

tfrommen Dec 22, 2016

Contributor

Hi there,

I had scheduled this issue for today already. :)

Even if you're right, the current behavior is not 100% correct, still.
For front-end requests/URLs, we should be using [get_]home_url() (instead of [get_]site_url()). This is not only the case in the location you linked to, but also in other locations.

I will handle this in a feature branch, so we both can test this before I will merge this.

Thanks,
Thorsten

Contributor

tfrommen commented Dec 22, 2016

Hi there,

I had scheduled this issue for today already. :)

Even if you're right, the current behavior is not 100% correct, still.
For front-end requests/URLs, we should be using [get_]home_url() (instead of [get_]site_url()). This is not only the case in the location you linked to, but also in other locations.

I will handle this in a feature branch, so we both can test this before I will merge this.

Thanks,
Thorsten

@tfrommen tfrommen added the bug label Dec 22, 2016

@tfrommen tfrommen modified the milestones: v2.5.0, v2.4.9 Dec 23, 2016

@tfrommen

This comment has been minimized.

Show comment
Hide comment
@tfrommen

tfrommen Dec 23, 2016

Contributor

Closed with 0c3de80.

Contributor

tfrommen commented Dec 23, 2016

Closed with 0c3de80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment