Opened 4 years ago
Last modified 2 years ago
#39587 new defect (bug)
link problems with language settings
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | 4.7 |
Component: | I18N | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
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!!
Ben
Change History (11)
#2
@
4 years ago
- Description modified (diff)
- Keywords reporter-feedback removed
This happens because the rewrite slug of the post type product
is translatable, see https://github.com/woocommerce/woocommerce/blob/7873a328ce871668143465f605df93b1683b0795/includes/class-wc-post-types.php#L258.
#4
@
4 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!!
Ben
#7
@
3 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 https://core.trac.wordpress.org/ticket/41116 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:
- Our user account has language set to English.
- Created a new site for German in multisite setup.
- Localized some strings that are used in permalink rewrites.
- Visited the permalink page on new German site, and saved (to refresh permalinks).
- Posts across the site show the new permalink (with localized URL) on frontend, but visiting them returns a 404.
- 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...
#9
@
3 years ago
I had the same issue today (Version 4.9.6) and patched that by disabling the user's option (https://tfrommen.de/disable-user-admin-language-in-wordpress/) 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
@
2 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:
- Make sure to have at least another language installed to help demo this...
- Set site language to German
- 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)
- Regenerate permalinks
Note: Permalinks should now go to: wp.local/Medien/postname
- Change user preferred language to english
- Go to CPT page and hover on "view"
Note: Permalink should suggest that the permalink is wp.local/media/postname
- 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.
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?