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.

Our next available supporter will start replying to tickets in about 6.41 hours from now. Thank you for your understanding.

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Andrey 1 year ago.

Assisted by: Andrey.

Author Posts
November 1, 2023 at 11:19 am #14706799

arnoP-3

Hi,

In page-sitemap.xml, generated by Rank Math, I found two URLs of translated pages that are invalid. They are missing the language directory. The correct URLs are in the sitemap as well.

For example:
hidden link (incorrect, throws a 404 error, should not be in the sitemap)
hidden link (correct)

I initially thought it was a Rank Math problem. But their support says it looks like WPML added incorrect translated entries for those URLs in the wp_posts table of the database.

They said I can fix the problem like this:
1. Access your database using the phpMyAdmin panel or a plugin like SQL Buddy.
2. Go to the posts table of the database and search the post_name column for the slug of the affected URL.
3. There must be two entries with similar post IDs. Remove the incorrect one.
4. Then go to WP Dashboard > Rank Math SEO > Sitemap Settings > General and change the links per sitemap to flush the sitemap’s cache and fix the issue.

But before I do something risky like this, is there a safer way to find the incorrect entries with WPML, and remove them? Without going into the database directly?

Kind regards,
Arno

November 2, 2023 at 12:38 pm #14716703

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Hi Arno,

Thank you for contacting WPML support. I've checked the URLs provided on your website, and the language switcher points them correctly if you switch the languages back and forth.

Additionally, looking at the source code of the page, hreflang is set correctly for /de/.

<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="de" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />

In my opinion, there is no need to perform any actions towards the database. Fixing the links in the sitemap should be enough.

Some known issues exist, and you can currently check if you are not experiencing one of them: https://wpml.org/documentation/plugins-compatibility/optimize-multilingual-websites-using-rank-math-and-wpml/#known-issues.

I hope this helps.

November 2, 2023 at 12:50 pm #14716769

arnoP-3

Hi Andrey,

Indeed, everything in the frontend works fine. I checked the known issues but they do not apply here.

The issue is that Rank Math generates two incorrect links in the XML Sitemap, because of wrong records in the database. WPML most likely put those records there. What do you suggest to solve this if there is no need to change anything directly in the database?

Thanks,
Arno

November 2, 2023 at 12:56 pm #14716803

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

What we are seeing on the frontend is coming from the database. I haven't noticed the incorrect URLs. Can you show me the wrong records in the database? So that we can verify the initial workaround.

November 2, 2023 at 1:59 pm #14717447

arnoP-3

You'll find two incorrect URLs in the XML Sitemap here if you search for "net/un": hidden link

Here's an example of a duplicate database record (726661 and 726662): hidden link . I'm not sure which one is incorrect.

November 2, 2023 at 3:33 pm #14718733

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for more details. Do you see them in the dashboard if you open them like this?

hidden link
hidden link

Or

hidden link
hidden link

Maybe in that way, you can check from the post-editing screen, understand what is wrong, and remove which are not necessary or duplicates.

Please backup your database before making any changes.

November 2, 2023 at 4:14 pm #14719379

arnoP-3

URL #1 and #2 both open the page in edit mode, but in case of #2 WPML throws a warning: "Sie versuchen, eine Übersetzung mit dem Standard-WordPress-Editor zu bearbeiten, aber Ihre Seite ist für die Nutzung des WPML Translation Editor konfiguriert."
Both have the exact same publish date. #2 has 4 revisions and #1 and no revisions.
I would guess that #2 (726662) is the correct URL and #1 (726661) is the duplicate, but I am not sure.

Opening URL #3 and #4 is almost identical to #1 and #2. The difference is that the URL shown by WordPress does not contain "/de/" for #3 and #4.

I also checked the WordPress list of pages with the WPML flag set to German, and found the same page twice. ID 726661 has no translation so that confirms that this is the wrong one I must delete, correct? You can see it here: hidden link

I also tried to find the second URL with the same issue in the WordPress list of pages, but couldn't find it. I can only find that one directly in the database wp_posts table.

What do you recommend and what may have caused this issue?

Thanks,
Arno

November 3, 2023 at 9:35 am #14724001

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Good investigation, Arno.

As far as I can page 726661 created in the German language, and it's being not a translation of anything. It looks exactly like 726662, which makes me think it can be safely deleted.

If you can't find the second URL in the list of pages, trash or draft, you may go ahead and delete it from the database. However, remember to create backups just in case.

Unfortunately, I'm not sure what could have caused these two entries to be incorrect.

November 4, 2023 at 2:34 pm #14731309

arnoP-3

Thank you Andrey. I used Adminer to double-check the incorrect post IDs. I deleted 726661 in the WordPress list of pages with WPML switched to German. The other was deleted using the WP Bulk Delete plugin.