Sauter la navigation

Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.

Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Sumit Il y a 1 année et 12 mois.

Auteur Articles
février 14, 2023 à 4:30 pm #13033071

baptisteH-2

On the page :
lien caché
( I use a add_rewrite_rule to make it equivalent to
lien caché )

tasks is CPT.
task-1 is the slug (name) of the current CPT.
s is a custom parameter. (can be "s" or "d" fyi)

In the language switcher the urls are :
for French : lien caché
for German : lien caché
My personal parameter is gone.

I tried to add it in WPML settings, cf the attachment.

But it doesn't work.

Any ideas how to keep that custom parameter

Screenshot 2023-02-14 at 17.23.11.png
février 15, 2023 à 8:00 am #13036683

Sumit
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hi,

Thank you for contacting the support forum.
Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

WPML language switcher parses the URL lien caché and translates its parameter then constructs a new translated URL.
Since it is not aware of custom parameter/s/ it is lost. The feature of persevering the URL parameter is meant to preserve the query string e.g. lien caché but you are using custom rewrite rules so it is not part of the query string.

I would suggest you construct the custom language switcher using our hooks https://wpml.org/wpml-hook/wpml_active_languages/ there are some examples you can use and then in the code, you can get the custom parameter and put in the new language URL as you like.

If needed you can also contact our custom work contractors https://wpml.org/contractors/

I hope it helps.

Le sujet '[Fermé] The language switcher urls don’t keep my full path' est fermé aux nouvelles réponses.