تخطي إلى المحتوى تخطي إلى الشريط الجانبي

الوسوم: 

يحتوي هذا الموضوع 0 ردود ، لديه 0 voices.

آخر تحديث بواسطة rayB-4 قبل 11 شهر، 1 أسبوع.

يساعده: Lauren.

الكاتب المشاركات
3 أبريل، 2025 في 8:08 م #16894787

rayB-4

Background of the issue:
I am trying to localize JavaScript with the translated URL using WPML. I am using the following code: apply_filters( 'wpml_permalink', get_the_permalink( $id), 'fr' );.

Note: The CPT titles are translated, and the translated URLs work elsewhere as expected.

Symptoms:
The function wpml_permalink is returning the original URL in the correct language directory instead of the fully translated URL. I am passing /myslug/in-english/ and getting /fr/myslug/in-english/, but I want /fr/myslug/en-anglais/.

Questions:
Will wpml_permalink only work as I wish at certain points in the request lifecycle?