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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - -
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - -

Supporter timezone: Asia/Jerusalem (GMT+02:00)

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by Itamar 5 months ago.

Assisted by: Itamar.

Author Posts
August 27, 2024 at 12:29 pm #16109728

Timothy

Background of the issue:
I am trying to have better multilingual support for Yoast SEO sitemaps on active WPML installations, using the "glue plugin" WPML SEO. In wpml_wpseo_loads_first(), the incorrect assumption is that WPML Core would always load sooner than WPML SEO, which might not be the case. The solution would be to first look for the current index of WPML Core and insert WPML SEO right after that index.

Symptoms:
Each domain sitemap listed all posts of different types regardless of the active domain language. WPML SEO's filters and actions weren't executed because WPML_Core_Version_Check::is_ok was returning false. ICL_SITEPRESS_VERSION was NOT defined, making that function return false. This was caused by WPML Core loading later than WPML SEO.

Questions:
There should be a fix for this.

August 27, 2024 at 7:02 pm #16111921

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Thanks for bringing this issue up.

I've passed it on to our second-tier supporters and awaiting their reply.
When I have their reply I'll update you here.

I appreciate your patience.
Itamar.

August 29, 2024 at 8:53 am #16118605

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Our second-tier supporter would like to know if you can provide a real scenario (steps) for replicating this problem.

Alternatively, provide a package of your site where we can reproduce the issue.

If it is a package you can provide or access to your site where we can see this issue, a private message is enabled for the following reply.

Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Thanks,
Itamar.

August 29, 2024 at 12:09 pm #16119865

Timothy

Hi Itamar,

Steps to reproduce the issue:

- Install latest versions of WP, Yoast SEO, WPML Core and WPML SEO. Configure WPML to use domains instead of folders.
- Have a CPT with some posts in several languages.
- Write a script to manipulate the option value of "active_plugins", so you can read/write to the option value easily.
- When you read the option value WPML Core should be at position 0 in the array, WPML SEO should be at position 1.
- Re-order the loaded plugins in "active_plugins" by putting WPML Core after WPML SEO.
- When viewing the CPT sitemap in the list of sitemaps on /sitemap_index.xml, you'll notice that all posts are visible in that sitemap for all languages, not the current language only.
- That's because no filters and actions of WPML SEO are loaded because of the order assumption in "active_plugins".

When developing, you should never assume anything, you should be 100% certain at all times, if not, build in checks and fallbacks to be sure.

My suggestion would be to rewrite wpml_wpseo_loads_first() in plugin.php and look for WPML Core in the list first, and put WPML SEO right after that found index.

September 1, 2024 at 12:48 pm #16128999

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Thanks a lot for the detailed steps.

I'm passing it on to our second-tier supporter.

Could you also share the script to manipulate the option value of "active_plugins"?

Thanks,
Itamar.

September 2, 2024 at 7:22 am #16130152

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Our second-tier supporter said he could not reproduce this case without the script.

Can you please help us add your script to the sandbox site we created for this matter?

You can access it through this link:

hidden link

With this link, you'll be directly logged in.

The Yoast SEO and WPML SEO plugins are already installed on this test site.

Important! Do not import your site to the test site. We must replicate the problem on a fresh, clean WordPress installation.

Thanks,
Itamar.

September 2, 2024 at 4:21 pm #16132890

Timothy

I've added code to the themes functions.php file, at the bottom. With comments.
After updating that file and navigating to the home, sitemaps are incorrect: hidden link

Let me know if you need anything.

// T

September 3, 2024 at 8:08 am #16134376

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Thanks a lot, T!

When I go to hidden link, I only see links to English posts, and each link is tripled. Moreover, I don't see the links to the French and Spanish posts. They are missing. Please see the attached screenshot.

Can you please confirm this is a good description of the problem?

Thanks,
Itamar.

2024-09-03_11-05-00.jpg
September 3, 2024 at 9:45 am #16134781

Timothy

Exactly, Itamar!

The posts you see are all posts in total but displayed with the english permalink. It's because no actions and filters are executed by the WP SEO plugin.

September 4, 2024 at 3:50 pm #16141809

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Thanks a lot, Timothy!

I've escalated this case to our compatibility team.

We'll keep you updated on news regarding this issue.

I appreciate your patience.
Itamar.

September 5, 2024 at 5:27 pm #16146257

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Our compatibility team escalated this issue to our developers.

We'll keep you updated here.

Regards,
Itamar.