 Sumit
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
|
Hi,
Thanks for the feedback!
I can just guess, please make sure the home page URL has the trailing slash. There should be only one version of the home page.
I have created our sandbox site which has the patched WPML version. Please login to the site hidden link and let me know if you can replicate the issue.
> Just a note: I will be out of the office on thursday and Friday.
If you can please replicate it today we will able to debug this while you are away. 🙂
Thanks
|
 steffenW-9
|
> I can just guess, please make sure the home page URL has the trailing slash. There should be only one version of the home page.
Not sure what you're referring to here, but maybe that's not relevant. The error was instantly reproducible for me:
Code is at the end of twentytwentyone functions.php:
// edit steffen wenzel
if (array_key_exists('test', $_GET)) {
echo '<pre>';
echo apply_filters('wpml_permalink', '<em><u>hidden link</u></em>', 'de', true);
echo '<pre>';
exit();
}
Result can be viewed at hidden link. It prints
hidden link
but should be printing
hidden link
(Permalinks were flushed.)
|
 Sumit
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
|
This is so weird. I just added another line below your code
echo apply_filters('wpml_permalink', '<em><u>hidden link</u></em>', 'de', true);
And it prints correctly.
I am checking it thanks!
|
 steffenW-9
|
Now you know how I felt these last hours when I tried to make sense of this ;-). My money is on the problematic ones starting with "en", like the language-slug, but we'll see.
|
 Sumit
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
|
Yes, that's correct I just found it too.
The issue is after the patch with slug starting with en 😀
If this appears in the middle or last that does not matter. I will check this on local where it is failing in code.
Meanwhile, please let me know how can I help? Do you need an alternative solution or do you really have a slug starting with en?
I can suggest some custom functions that can do the job instead of this filter.
|
 Sumit
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
|
Hi,
You can use this function instead of filter while we will report this to devs.
function wpmlsupp9957_get_translated_permalink($post, $lang = false, $leavename = false) {
$current_lang = false;
//Store the current lang and switch to provided lang.
if (!empty($lang)) {
$current_lang = apply_filters( 'wpml_current_language', null );
do_action( 'wpml_switch_language', $lang );
}
$permalink = get_permalink($post, $leavename);
//If we switched the language switch back to original.
if (!empty($current_lang)) {
do_action( 'wpml_switch_language', $current_lang );
}
return $permalink;
}
Use it like instead of get_permalink()
echo wpmlsupp9957_get_translated_permalink(52, 'de');
I can see the correct output here hidden link
Thanks
|
 steffenW-9
|
> Meanwhile, please let me know how can I help? Do you need an alternative solution or do you really have a slug starting with en? I can suggest some custom functions that can do the job instead of this filter.
No need. This wasn't even my original problem. I think I'll open another ticket for that.
|
 Nigel
WPML Supporter since 02/2016
Timezone:
Europe/Madrid (GMT+02:00)
|
I'm happy to see the progress that was made here in my absence yesterday.
I'm going to mark this thread as escalated, and I can update here again when the fixes are included in plugin updates and it is no longer necessary to use any workarounds.
|
 steffenW-9
|
Any updates regarding this?
|
 Nigel
WPML Supporter since 02/2016
Timezone:
Europe/Madrid (GMT+02:00)
|
Not yet. Sumit created the internal tickets relating to the above issues, and they are in the development queue, but I don't see when this will be worked on.
When that changes I'll get a notification and will update you.
|