Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#39587 new defect (bug)

link problems with language settings

Reported by: aansel Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 4.7
Component: I18N Keywords:
Focuses: Cc:

Description (last modified by ocean90)

Dear Developers!

After WP versiion 4.7 i think i found a bug it is not listed.

In version 4.7 we have the option to have a X site language but with Y language admin dashboard. (clever idea Cheers for it!!)

But if i use the dashboard in Y language >>> it changes the links (after you edit something) language to Y language. (maybe it is related ~only in/with woocommerce)

for example the link changes from "product" to "termek" or vica-versa...

makes many pages unreachable...

let me know if you need any further information or help!

Very Best regards!!


Change History (11)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to I18N
  • Keywords reporter-feedback added

Hi @aansel, welcome to Trac! Thanks for the report.

Do you use a multilingual plugin? Does it still happen with all plugins disabled and a default theme (Twenty Seventeen or Twenty Sixteen) activated?

#2 @ocean90
5 years ago

  • Description modified (diff)
  • Keywords reporter-feedback removed

This happens because the rewrite slug of the post type product is translatable, see

#3 @SergeyBiryukov
5 years ago

#39416 was marked as a duplicate.

#4 @aansel
5 years ago

okay Guys!!

sorry to took so long to reply!
Im not sure im understand well what You wrote?!
My post is a duplicate?! (becose 39416 is another post)

Please tell me if you need any further info i will reply lot quicker!

Wish You the best!!

#5 @grapplerulrich
5 years ago

No the other ticket was marked as a duplicate of this ticket.

#6 @ocean90
5 years ago

#41116 was marked as a duplicate.

#7 @bradadams
4 years ago

  • Severity changed from normal to major

This is a super critical issue, I'm unsure how it's not been addressed yet 🤔. I created the ticket for this 5 months ago and this one has nearly been around for a year.

We just spent like 40 minutes scratching our heads as to why all our localized permalinks went down the plughole after we re-saved them. The steps were:

  1. Our user account has language set to English.
  2. Created a new site for German in multisite setup.
  3. Localized some strings that are used in permalink rewrites.
  4. Visited the permalink page on new German site, and saved (to refresh permalinks).
  5. Posts across the site show the new permalink (with localized URL) on frontend, but visiting them returns a 404.
  6. Visiting the posts screen in admin, and clicking "view" on a post takes you to the correct URL (using English permalink localization in this case).

So of course we're like wtf, why's it showing english if all settings are clearly pointing to German/Deutsch?

Luckily we remembered this issue, and just had to change our user language to the relevant sites language before making the re-save on the permalinks screen.

If someone can point me in the right direction I'll try and fix it myself, either way, over the holidays I'll see if I can figure out what's causing it...

Last edited 4 years ago by bradadams (previous) (diff)

#8 @ocean90
4 years ago

#43991 was marked as a duplicate.

#9 @realloc
4 years ago

I had the same issue today (Version 4.9.6) and patched that by disabling the user's option ( to change the language.

This is far from perfect but at least the feature creates no problems at the moment.

I understand that $wp_rewrite is global and the call to flush_rewrite_rules is hard-wired in options-permalink.php. Could a check for a difference between get_locale() and the user's language (maybe with an admin_message that informs about the implications) a good starting point to give a hand here?

#10 @eddhurst
3 years ago

@tferry noticed this issue earlier this week, and we've been investigating. I agree, this still happens and is relatively easy to reproduce:

  1. Make sure to have at least another language installed to help demo this...
  1. Set site language to German
  2. Create new custom post type, set slug to use a translatable string ("media" is good example that WP has a translatable string for in core)
  3. Regenerate permalinks

Note: Permalinks should now go to: wp.local/Medien/postname

  1. Change user preferred language to english
  2. Go to CPT page and hover on "view"

Note: Permalink should suggest that the permalink is wp.local/media/postname

  1. Regenerate permalinks again

Note: Permalinks will now actually change to wp.local/media/postname

As mentioned earlier - we can see that the slug ends up changing based on the admin preferred language rather than the site language - which isn't immediately obvious why.

Ultimately the localisation scripts are running first and doing all the translation - including the slug. This seems reasonable, as we do need the other strings (CPT labels etc) to be translated.

To fix this at the highest level it seems like it would make sense to hijack the arguments in the class definition of WP_Post_Type and re-translate based on site language, that way we can reliably ensure that it will always be correct anywhere else that it is used.

This ticket was mentioned in Slack in #core by tferry. View the logs.

3 years ago

Note: See TracTickets for help on using tickets.