Saltar al contenido Saltar a la barra lateral
Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 -
- 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 -

Zona horaria del soporte: Asia/Kathmandu (GMT+05:45)

Este tema contiene 0 respuesta, tiene 1 voz.

Última actualización por adrienR-5 hace 2 meses.

Asistido por: Shekhar Bhandari.

Autor Publicaciones
junio 24, 2025 a las 8:52 am #17163675

adrienR-5

Background of the issue:
I am developing a site and have added some query_vars and rewrite_rule to create dynamic pages.

Here's my current code: "function sws_franchise_reviews_custom_query_vars($vars) {
$vars[] = "franchise_slug";
$vars[] = "franchise_reviews_page";
$vars[] = "franchise_review_id";

return $vars;
}
add_filter("query_vars", "sws_franchise_reviews_custom_query_vars");

function sws_franchise_reviews_custom_rewrite_rule() {
add_rewrite_tag("%franchise_name%", "([^/]+)");
add_rewrite_rule(
"^franchise/([^/]+)/avis/?",
'index.php?franchise_name=$matches[1]&post_type=franchise&franchise_reviews_page=1&do_not_redirect=1',
"top"
);
add_rewrite_rule(
"^franchise/([^/]+)/avis/([^/]+)/?",
'index.php?franchise_name=$matches[1]&post_type=franchise&franchise_reviews_page=1&do_not_redirect=1&franchise_review_id=$matches[2]',
"top"
);
}
add_action("init", "sws_franchise_reviews_custom_rewrite_rule", 10, 0);"

This is working well for my default language (FR).

Symptoms:
I need to create similar functionality for different WPML languages.

Questions:
How can I create similar query_vars and rewrite_rule for different WPML languages?

El tema '[Cerrado] Create query_vars and add_rewrite_rule for alternative WPML languages' está cerrado a nuevas respuestas.