WPML (query param language mode) and Custom-permalink compatibility issue
-
Hi,
we are using custom-permalink together with the WPML plugin.
In our installation wpml is configured to have the language as the query parameter; example: https://www.mysite.com/my-custom-page/?lang=enIt seems that custom-permalinks is not compatible with this wpml mode
For example custom-permalinks plugin use the home_url() function in class-custom-permalinks-frontend.php and class-custom-permalinks-form.php assuming that this returns (after be filtered by wpml), an home_url without query params (only wpml configured with language path or domain mode, would work; example: https://www.mysite.com/en/my-custom-page/)// not working code from class-custom-permalinks-frontend.php
$permalink = ltrim(str_replace(home_url(), ”, $ permalink), ‘/’);and also more explicitly in the wpml_permalink_filter hook there is a language concatenation:
$permalink = $site_url. ‘/’. $language_code. ‘/’. $custom_permalink;I understand that being compatible with the various features of multilingual plugins (wpml, polylang, etc.) is complex but if you could
release an hook when you use the home_url function (for example custom_permalinks_home_url) we could redefine the home_url according to the wpml configuration that we are using.would it be possible to have this hook in an upcoming release?
Best
Alessandro
- The topic ‘WPML (query param language mode) and Custom-permalink compatibility issue’ is closed to new replies.