WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Polylang breaking static front page on new WP 3.5 installation (8 posts)

  1. lloydo3000
    Member
    Posted 1 year ago #

    Hi Chouby, firstly I'd like to echo everyone else's praise for Polylang. Thanks for this excellent plugin.

    I've had a search around but couldn't find any reports directly related to the issue I'm having. I am using a fresh copy of InstantWP and upgraded to WP 3.5 immediately. Using latest version of Twenty Twelve and Polylang 0.9.8.

    While testing Polylang, I've noticed that there is some redirection problem with a combination of /%postname%/ (pretty) permalinks and a static front page. The home page http://127.0.0.1:4001/wordpress/ will not load in this case. I have translated all the necessary pages.

    If I switch to default permalinks, or use latest posts as the front page, http://127.0.0.1:4001/wordpress/ loads no problem.

    Firefox usually just displays this message:

    The page isn't redirecting properly
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    This problem can sometimes be caused by disabling or refusing to accept cookies.

    Once or twice I was able to display PHP error codes, the first time was when I was poking around the theme customiser, but I can't remember how they came up the second time.

    Warning: rtrim() expects parameter 1 to be string, object given in C:\Users\User\Downloads\InstantWP\InstantWP_4.3\iwpserver\htdocs\wordpress\wp-includes\formatting.php on line 1381

    This is referring to function untrailingslashit()

    Warning: Cannot modify header information - headers already sent by (output started at C:\Users\User\Downloads\InstantWP\InstantWP_4.3\iwpserver\htdocs\wordpress\wp-includes\formatting.php:1381) in C:\Users\User\Downloads\InstantWP\InstantWP_4.3\iwpserver\htdocs\wordpress\wp-includes\pluggable.php on line 876

    This is referring to function wp_redirect()

    Here are my Polylang settings:
    [Default language] English

    [Detect browser language] Checked

    [URL modifications]
    1. Language set from context (Selected)
    2. Language code /en/ added to pretty permalinkss (Unselected)

    3. Remove /language in pretty permalinks (Selected)
    4. Keep /language/ in pretty permalinks (Unselected)

    5. Hide URL language information for default language (Unselected)
    6. Redirect language page to static front page (Unselected)

    [Synchronisation] Checked

    When I select option 6 in that list, the front page loads again, but in the opposite way to how it is supposed to work.

    I.e. http://127.0.0.1:4001/wordpress/ redirects to http://127.0.0.1:4001/wordpress/en/

    Have I just spent too long documenting how the plugin is supposed to work? I would expect this behaviour if I had option 2 selected. Or is this an actual bug?

    My preference would be to always have the neatest URL possible: I'd like the homepage to just be http://domain.com/ when I deploy it. Not http://domain.com/fr/ (or equivalent language code).

    Thanks in advance for your help! I'm happy to test the 1.0 beta if you like, but I don't have access to a webserver at the moment, so it would be once again through InstantWP.

    Cheers,
    Lloyd

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    I know there is an issue with the homepage when the url includes a port like http://127.0.0.1:4001/

    The current development version should already solve this. So I would be happy to get your feedback if you can test it with InstantWP,

  3. lloydo3000
    Member
    Posted 1 year ago #

    Thanks for the reply Chouby.
    I uninstalled 0.9.8 and installed the 1.0dev13 version.

    1. I added my languages then went to Settings and checked the box to set all pages to English. Then I went to my test pages and set the non-English ones to the correct language.
    2. I then went to http://127.0.0.1:4001/wordpress/ and was redirected to http://127.0.0.1:4001/wordpress/en/ showing me the posts front page with the title "English"
      This redirect at least worked, but it wasn't what I expected. I expected to be shown my static front page in English, with the URL http://127.0.0.1:4001/wordpress/
    3. In WP Settings/Reading, I noticed my static front page was set to an Italian front page. I changed it to the English variation, and now http://127.0.0.1:4001/wordpress/ redirects to http://127.0.0.1:4001/wordpress/sample-page-in-english/
    4. Up to this point, all my Polylang settings were the same as in my previous post. I then selected [Redirect language page to static front page] and noticed the same behaviour as I wrote last time:

      When I select option 6 in that list, the front page loads again, but in the opposite way to how it is supposed to work.

      I.e. http://127.0.0.1:4001/wordpress/ redirects to http://127.0.0.1:4001/wordpress/en/

    5. I also noticed that manually navigating to http://127.0.0.1:4001/wordpress/es/ displayed an archive of all my pages (not posts).
    6. Furthermore, language-switching (e.g. from Sample Page EN to Sample Page IT) no longer functions, taking me directly to http://127.0.0.1:4001/wordpress/it/
      Toggling on/off the "Forces link to front page" setting had no effect.
    7. From the previous point, with the option "Hides the current language" selected, at least the Italian flag was missing, meaning Polylang at least knows which language it should be displaying.

    I'm sorry to give you bad news and hope I have explained everything clearly enough for you to figure out what's going on.

    Cheers,
    Lloyd

    Other comments, unrelated!
    I noticed the languages I added in Languages didn't show in the order I added them in the other places (e.g. String translation, admin menu Languages drop-down). Note this is with all at Order of 0.

    I added them in alphabetical order, e.g.
    1. English
    2. Español
    3. Français
    4. Italiano
    but they are displayed in the order 1/ 4/ 3/ 2/
    After setting the Order, it's fine, but this behaviour is different to 0.9.8.

    I also have a comment regarding the UI, I think on the Menus tab you should start the check boxes with "Display language switcher at end of menu" and only enable the others if it is checked. Am I right that they have no effect otherwise?

  4. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    There are no bad news, only a good test and I thank you for that!

    When I select option 6 in that list, the front page loads again, but in the opposite way to how it is supposed to work.

    I.e. http://127.0.0.1:4001/wordpress/ redirects to http://127.0.0.1:4001/wordpress/en/

    This is the expected result. If you unselect the option 5, then http://127.0.0.1:4001/wordpress/ will always redirect to the front page in the preferred language (or the default language). Now selecting the option 6 just means that your front page url is no more http://127.0.0.1:4001/wordpress/sample-page-in-english/ but http://127.0.0.1:4001/wordpress/en/ and that this later url will no more display the archive of posts in English.

    I also noticed that manually navigating to http://127.0.0.1:4001/wordpress/es/ displayed an archive of all my pages (not posts).

    Did you translate your home page in English to Spanish? If yes, it should display the static front page in Spanish. If not, it won't work. There is however a valid bug here as there is no control of what is done in that case. I observed the same comportment as you in 0.9.8 but a different one in the current development version 1.0dev14. I am not sure what I should display in that case. Maybe a 404 ?

    Furthermore, language-switching (e.g. from Sample Page EN to Sample Page IT) no longer functions, taking me directly to http://127.0.0.1:4001/wordpress/it/
    Toggling on/off the "Forces link to front page" setting had no effect.

    If you set the Sample Page EN as your static front page, then this is the expected result, as now the Sample Page EN is your homepage in English and its url is http://127.0.0.1:4001/wordpress/en/ and the url of its Italian translation is http://127.0.0.1:4001/wordpress/it/.

    I added them in alphabetical order, e.g.
    1. English
    2. Español
    3. Français
    4. Italiano
    but they are displayed in the order 1/ 4/ 3/ 2/
    After setting the Order, it's fine, but this behaviour is different to 0.9.8.

    They should always be displayed in the order you created them whatever the version used. At least it is what I observe on my test site with both 0.9.8 and the development version.

    I also have a comment regarding the UI, I think on the Menus tab you should start the check boxes with "Display language switcher at end of menu" and only enable the others if it is checked. Am I right that they have no effect otherwise?

    I already noticed this issue appeared in 1.0dev13 and came back to the previous situation in the current development version 1.0dev14

  5. lloydo3000
    Member
    Posted 1 year ago #

    Thanks for your reply again Chouby.

    This is the expected result. If you unselect the option 5, then http://127.0.0.1:4001/wordpress/ will always redirect to the front page in the preferred language (or the default language). Now selecting the option 6 just means that your front page url is no more http://127.0.0.1:4001/wordpress/sample-page-in-english/ but http://127.0.0.1:4001/wordpress/en/ and that this later url will no more display the archive of posts in English.

    OK I tried this and it sort of worked for English, which I had set in the Polylang settings as default. I was confused by the wording. When you say default, do you mean what I set as the Polylang default language, or the language of the visitor's computer?

    E.g. if a French person visited the website then their default language is French (from their computer/browser). And since I have asked Polylang to set the language from the browser, it should want to display French. So is the preferred language French now? Or is the preferred language set when their Italian friend uses their computer, and clicks the IT flag to display the site now in Italian? Maybe it would be good to clarify the terms used to describe the set language. An idea:

    +============================================+
    |      Language definitions in Polylang      |
    +============================================+
    | TERM       DESCRIPTION                     |
    | ------------------------------------------ |
    | Base       Language from Polylang Settings |
    | Default    Language set from browser       |
    | Preferred  Language set by user action     |
    +============================================+

    I was hoping that whenever a language was chosen, the URL would appear without language notation (i.e. without referring to the language). Although I guess it doesn't matter too much to have /es/ there... of course having every page working is more important!

    Did you translate your home page in English to Spanish? If yes, it should display the static front page in Spanish.

    I have two sets of test pages from the WP 3.5 installation, the Sample Page and the Contact Us page, both in EN/ES/FR/IT. But here was my error: after I uninstalled 0.9.8 and installed 1.0dev13, I set these pages to their correct languages, but I didn't update the links between them (Polylang didn't know which page was related to the other).

    Now I fixed that, everything is working better! And I have just realised that I must set up individual menus for each language (beforehand, I presumed that language switching was automatic, i.e. if you clicked on a flag, then subsequent browsing would always redirect you to pages in that language).

    So I have just set up another three menus in French/Italian/Spanish and told Polylang to use them. Now navigating to http://127.0.0.1:4001/wordpress/ just gives the two PHP errors I posted originally!

    Navigating to http://127.0.0.1:4001/wordpress/en/ brings up the 404 page, but in Italian (probably set from the last page I was viewing). Other pages in the Italian menu worked, such as Contact Us IT. I was also able to switch to Contact Us ES/FR.

    Clicking the English flag, expecting to go to Contact Us EN (http://127.0.0.1:4001/wordpress/contact-us/) instead took me to http://127.0.0.1:4001/wordpress/<strong>english</strong>/

    I went back to the Polylang Languages page and sure enough, the code for English had magically changed itself from en to english! I remember this happening to me with 0.9.8 as well, but I can't remember exactly how. My guess is something happens when one of the Polylang settings pages is saved (incidentally, you don't display the yellow messages at the top like in the rest of WP does to confirm a successful action).

    Maybe english is hard-coded somewhere? I cannot think of how it got there otherwise, I just used the drop-downs to make the languages. (I'd prefer to use en_GB but I gather it isn't available on WP). Oh, unless it is the menu slug? One of the 4 menus is called English.

    Anyway, after fixing the slug back to en the homepage loads again, but it loads the Sample Page ES. This is the page I specified in Reading settings, but beforehand I was being successfully redirected to Sample Page EN... strange.

    Update: After the upgrade to 1.0dev14, this problem is gone. Who knows if/when it will return!

    I am not sure what I should display in that case.

    Since Polylang knows which language the user requested, maybe an error message in their language? You could provide a list of the languages available for that page, and even an online translation? Maybe:
    Sorry, the content you requested is not available in XXX language. You may choose from these currently available languages or try a machine-translated version.

    I just downloaded 1.0dev14 to test. It made me think, what is the preferred way to keep the relationships between pages when upgrading or migrating a WP installation?

    They should always be displayed in the order you created them whatever the version used. At least it is what I observe on my test site with both 0.9.8 and the development version.

    I've just installed 1.0dev14, and added the 4 languages in alphabetical order. On the Languages page they are in the correct order, but everywhere else in the dashboard, they are now in the order 3/ 4/ 1/ 2/ ... totally random!

    I already noticed this issue appeared in 1.0dev13 and came back to the previous situation in the current development version 1.0dev14

    That's good, however it would be even easier to understand if the subsequent check boxes were disabled until the first was checked.

    I'm really grateful for your work on this, and your replies. I am sorry I write such long ones, but I'm trying to be specific and helpful!

    Cheers,
    Lloyd

  6. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    These are my definitions:
    * default language: set from Polylang settings
    * preferred language: set the first time from browser preferences and then from the last browsed page (by cookie).

    So I have just set up another three menus in French/Italian/Spanish and told Polylang to use them. Now navigating to http://127.0.0.1:4001/wordpress/ just gives the two PHP errors I posted originally!

    I never have these errors. I will try to find where they come from.

    I went back to the Polylang Languages page and sure enough, the code for English had magically changed itself from en to english!

    You are the first to report this bug, although I am quite sure it is as old as Polylang (and probably present in WP for even longer). If you know that Polylang uses a taxonomy for the languages and if you read this bug report, I am sure you will understand what happened. So 1.0dev14 does not solve this. Hopefully WP will solve it in a new version. Thank you for finding this out and pointing to the right direction.

    I've just installed 1.0dev14, and added the 4 languages in alphabetical order. On the Languages page they are in the correct order, but everywhere else in the dashboard, they are now in the order 3/ 4/ 1/ 2/ ... totally random!

    If you don't specify any order, I suppose that they should come in the order they are stored in the database. Maybe it's different from a MYSQL version to another? Or have you the same terms already existing in a different taxonomy?

    That's good, however it would be even easier to understand if the subsequent check boxes were disabled until the first was checked.

    You are right, but it will not come soon. You know... priorities...

  7. lloydo3000
    Member
    Posted 1 year ago #

    Thanks for replying!

    Hmm, that is a strange bug. I do understand what is happening now.

    But I have no idea what was happening with the language order. But it's a tiny issue that is easily fixed by setting the Order.

    I would like to give you some ideas at a later time (priorities!) regarding the interface, as I think it is not totally intuitive. The code you have written underneath is brilliant, and I'm sure Polylang is/will soon be the #1 language plugin.

    If you'd like me to test newer dev versions just reply back. Oh, and you never said what is the preferred method for migrating a WP installation? I gather that updating/overwriting the plugin doesn't require you to restore your settings and the links between translated pages, but what if you want to move to a new server?

    Cheers,
    Lloyd

  8. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, I missed this question. All data are stored in the database. If you deactivate the plugin, delete files, overwrite files, no data is lossed. I you delete the plugin using the red delete link in the plugin list table, then everything is erased. I guess every plugin should work like this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic