Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 -
- 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

Tagged: 

This topic contains 24 replies, has 3 voices.

Last updated by Nigel 1 year, 6 months ago.

Assisted by: Nigel.

Author Posts
July 27, 2022 at 11:04 am #11749785

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

July 27, 2022 at 11:32 am #11750055

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.)

July 27, 2022 at 1:09 pm #11750751

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!

July 27, 2022 at 1:14 pm #11750761

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.

July 27, 2022 at 1:20 pm #11750861

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.

July 27, 2022 at 1:36 pm #11750997

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

July 27, 2022 at 1:41 pm #11751015

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.

July 28, 2022 at 2:54 pm #11760491

Nigel
Supporter

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.

September 27, 2022 at 8:33 am #12129223

steffenW-9

Any updates regarding this?

September 27, 2022 at 8:40 am #12129291

Nigel
Supporter

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.